[REBOL] Objects, Making-Of Re:(2)

2000-07-03 Thread Christian . Ensel

Hello [EMAIL PROTECTED]!

On 03-Jul-00, You wrote: 

[...]
> The two blocks look the same, but they aren't.
[...]

That's what was irritating me ...


But now the context thing comes in for real, ;-)
Look at the following console session 

-- Start of console session --
>> a: 0 f: func [] [a]
>> o1: make object! [a: 1 g: func [] [a]] o1/g
== 0
>> o2: make object! append [a: 2 g:] [:f] o2/g
== 0
>> o3: make object! append [a: 3 g:] compose/deep [first [(:f)]] o3/g
== 0
>> o4: make object! append [a: 4 g:] reduce ['first reduce [:f]] o4/g
== 0
>> o5: make object! append [a: 5 g:] reduce ['func first :f second :f] o5/g
== 5
>> o1/g o2/g o3/g o4/g o5/g a
1
5
5
5
5
0
-- End of console session --

o1 is okay, anyway.
The making of o3 and o4 are equivalent IMHO (o3 are Gabriele's idea, o4 Ladislav's).
o5 is my own approach, it keeps care of contexts, but - as Ladislav pointed out - 
doesn't work for
native!s and action!s.

Any idea on how an o6 can be done, which preserves context *and* works for
native!s and action!s?

And finally, why do I get that strange 1 5 5 5 5 0 results? How does o2 to o4
know about o5's a: 5? Lots of homework to do ... 

Regards

   Christian
   [EMAIL PROTECTED]




[REBOL] Objects, Making-Of Re:(2)

2000-07-03 Thread Christian . Ensel

Hi Ladislav,

> 1) you shouldn't redefine Function (a Rebol mezzanine), but that
> didn't cause your trouble

This was just to use speaking names for the example :) 

> 2) the problem has nothing in common with contexts.

Obviously I'm still not able to assume correctly where my problems with Rebol
are located ...
 
> instead try eg. append spec reduce ['first reduce [:f]]

Thanks! 
That surely did it - even I still don't fully understand the problem.
Looks as if I were trying to append the function itself instead of just
it's source code (spec and body).

BTW, meanwhile I found that

>> append spec reduce ['func first :f second :f]

works, too. I once knew about that, but thought there should be a more direct
approach. Like Yours.
 
Regards

Christian
[EMAIL PROTECTED]