[REBOL] Re: Bug! in assignment to date! values with stacked set-path values
From: rotenca:telvia:it at: 20-Nov-2002 19:33
Hi Gabriele
> makes really sense out of this simple example. I would find the
> following really unintuitive:
>
> f: func [a b c] [reduce [a b c]]
>
> f/1 1 2 3 ; == 1
> f/2 1 2 3 ; == 2
> ; etc.
You find it unintuitive because you think at refinement as /word.
If
a: [b 1]
a/b
means:
1) evaluate 'a
2a) if a results in a block, select it with the word 'b
2b) if a results in a object, get in it the word 'b
I should like that this means the exactly same:
a: func [][[b 1]]
a/b
1) evaluate 'a (which, because it is a function, means "execute the body and
return the last value")
2a) if a results in a block, select it with the word 'b
2b) if a results in a object, get in it the word 'b
Instead, because function refinements are = path divisor (only for a choice)
that expression means all another thing:
"evaluate the function and pass /b as a refinement to it."
and before evaluating 'a i can't know what is the right interpretation!
Functions are first class?
> (Imagine it when you have less trivial arguments, as in a long
> expression.) I would much prefer:
>
> (f 1 2 3)/1
> (f 1 2 3)/2
this is indipendent from the previous: can be considered an extension of the
previous to pass arguments to a function (but could be used for compatibility:
a/b ;old interpretation
(a)/b ; my interpretation
(a/d 1)/b ; my interpretation + function refinement + arg
> Anyway, the path notation is just a shortcut notation. When you
> can't use paths, you can use PICK and POKE, so there's no real
> limitation.
yes, you must only decide between
1) Pick, Select, Get In, call a function
2) Poke, Change Find, Set In, call a function
Not so simple...
---
Ciao
Romano