r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Maxim
6-Apr-2006
[225x2]
why not:

 f: func/init [arg] [[arg: 2]  print arg]
since its a dialect, func could just steal the first block... IF 
its a block
Gregg
6-Apr-2006
[227]
It could alsmost work with the existing syntax, in the type spec 
for an arg, because you can use example values in the spec for a 
type.
Maxim
6-Apr-2006
[228]
it also allows local vars within face action  :-)
Gregg
6-Apr-2006
[229x3]
I don't like that Max, as it's totally different from the norm.
There are problems if we use the existing syntax, so it's a question 
of how it would break things, and how many things would break.
e.g. you could use a paren! value, since they aren't evaluated in 
the spec, but that will break the .0000001% that use it today.
MichaelB
6-Apr-2006
[232x2]
f: func [arg (1)][print arg]
?
Gregg
6-Apr-2006
[234]
e.g.  fn: func [/opt n [(0) integer!] [print n]
Maxim
6-Apr-2006
[235]
Gregg, you mean:

f: func [/opt value [44 integer! none!]] [ print value]
Gregg
6-Apr-2006
[236]
<he he>
Maxim
6-Apr-2006
[237]
problem with the parens is that it gets in the way of compose
Gregg
6-Apr-2006
[238]
Yes, that's the basic idea. I'd say it's rare for people to use literal 
values in specs, but they *can* do it today. And, yes, parens conflict 
with COMPOSE but, again, how much code COMPOSEs func specs?
MichaelB
6-Apr-2006
[239]
why not allow all the datatypes in the brackets ?, so only the words 
are datatypes for the value and the rest could be an initialization 
value
Gregg
6-Apr-2006
[240]
We can decide on any semantics, paren or any literal value, since 
it's really just a convention, like /local in the spec.
MichaelB
6-Apr-2006
[241x4]
f: func [/opt n [#12 issue!][print "or something like that"]
this looks pretty natural IMO ?
more than with paren!
there was a ] missing
Maxim
6-Apr-2006
[245]
hum... not sure about the #  obscure, especially for newbies...  
depends on the datatype    ##{a}  ,   #'toto
Gregg
6-Apr-2006
[246x2]
We could also say that only the first value is the default if it's 
a literal; any number of options in this line. The remaining issue 
is how to define a default datatype! value.
I think he was using a literal issue! there Max.
MichaelB
6-Apr-2006
[248]
sorry that was just because n was a issue! datatype - I thought
Maxim
6-Apr-2006
[249]
ok.
MichaelB
6-Apr-2006
[250x3]
like f: func [/opt string ["hello" string!]][print string]
just for 'word the order would be necessary
else it could be free - but this would be bad for the habit and learning
Gregg
6-Apr-2006
[253]
This is something we could mock up today, to see how we like it.
Maxim
6-Apr-2006
[254]
Michael, is your example different from what I posted last?  I see 
no difference...
MichaelB
6-Apr-2006
[255]
no :-) I see.
Maxim
6-Apr-2006
[256]
but keeping with consistency, not having any : in there does not 
seem right.
MichaelB
6-Apr-2006
[257]
where you wanna put the :
Maxim
6-Apr-2006
[258x2]
HA!  if the value is a set word?
as in f: func [/opt val: 4 [integer!]] [print val]
MichaelB
6-Apr-2006
[260x2]
one problem could be how to handle
f: func [/opt a-word [integer!]][...]
actually I kind of like this also - and wouldn't cause interpretation 
problems
Maxim
6-Apr-2006
[262]
it is very consistent with the rest of REBOL IMHO
MichaelB
6-Apr-2006
[263]
problem compared to 
f: func [/opt a-word [the-word]][...]
Maxim
6-Apr-2006
[264]
Gabriele said there might be issues with using a set word within 
the func spec block,  but if func really is a dialect... I don't 
see how.
MichaelB
6-Apr-2006
[265x2]
so what was the reason against your last (and has been before) idea 
?
ok
Maxim
6-Apr-2006
[267x2]
in any case, some words should be reserved  (like 'return)
So Gregg what do you think?
Gregg
6-Apr-2006
[269x2]
I think either one of these last two options we've come up with could 
work. I want to think about it a bit more, and others may chime in 
as well. I'm wondering if the extra block approach as easy to do, 
and had good performance, where this may have a bigger impact, but 
I like this line of thinking much better.
as easy to do = was easy to do
Maxim
6-Apr-2006
[271]
I do think that the set word approach is more approachable and much 
more readable... do you agree?
Gregg
6-Apr-2006
[272]
I'm not sure. At a glance I like it, but then I think about other 
things that we may want to do in the future, e.g. constraints.
Maxim
6-Apr-2006
[273]
constraints?
Gregg
6-Apr-2006
[274]
e.g. specify that an integer param must be positive.