[REBOL] Re: Obscure? You be the judge!
From: lmecir:mbox:vol:cz at: 15-May-2002 21:34
Hi Romano,
<<Romano>>
...
Some observations:
1) set-words should be unique, this is not a problem with your blank-object,
but is a problem with your lfunc.
<</Romano>>
<<L>>
Yes, I know that LFUNC isn't able to handle the cases, in which duplicities
occur. I should repair it... I wonder, how many users does the function
have?
OTOH, it is unnecessary to complicate the above code (IMHO)...
<</L>>
<<Romano>>
2) Because of return bug, it is better
get/any in object 'self
instead of
return get/any in object 'self
<</Romano>>
<<L>>
The native MAKE PROTO can return even error values. I cannot simulate that
without RETURN...
<</L>>
<<Romano>>
3) I did not test your code, but it seems to me that it bind the body
function
to the new context. This is only half correct: binding is done in Rebol
before
adding the new set-words of spec to the new object:
d: "global"
a: context [b: does [print d]]
a/b; == global
a2: make a [d: "local to a2"]
a2/b; == global
As you can see, the d word in the func body is not binded to the a2 context.
But:
a: context [b: does [print d] d: "local to a"]
a/b; == local to a
a2: make a [d: "local to a2"]
a2/b; == local to a2
<</Romano>>
<<L>>
Thanks for your analysis. This behaviour is really complicated. (I wonder
what will Joel say to this?)
d: "global"
a: context [b: [d]]
get first a/b; == global
a2: make a [d: "local to a2"]
get first a2/b; == global
a: context [b: [d] d: "local to a"]
get first a/b; == local to a
a2: make a [d: "local to a2"]
get first a2/b; == local to a2
(uff)
I need to define a special binding function that binds only partially, I
didn't find any other way how to simulate it?
<</L>>
<<Romano>>
4) instead of parsing all the block, because the only oddity of make object
is
copy and binding the function bodies, one could use bind and copy deep and
then finding and changing only the function values, but i did not try.
<</Romano>>
<<L>>
neither did I...
<</L>>
<<Romano>>
5) why this any-type? ?
any-type? set/any 'value pick next second proto i
---
Ciao
Romano Paolo Tenca
<</Romano>>
<<L>>
It could be any type value (e.g. error).
Ciao
Ladislav