Hello [EMAIL PROTECTED]!

On 27-Mag-00, you wrote:

 w>  Now for some mysterious stuff:

 w> x: make object! [self: make self [a: 1 b: 2] c: 3 d: 4]

 w>  What do you suppose is happening here? :-) It's a little
 w>  mystery. (-:

Looking at the result of:

>> obj: make object! [self: 3]
== 3

I assume that the code above is rougly equivalent to:

  use [c d] [
    c: 3 d: 4
    x: make object! [
       a: 1 b: 2 c: 3 d: 4
    ]
  ]

(The difference is subtle; I'll leave it as a puzzle for the
reader. :-) )

A more readable version of the above is:

  make object! [
    set 'x make self [
      a: 1 b: 2
    ]
    c: 3 d: 4
  ]

Being C and D duplicated in the "inner" object, using them as
hidden variables may be tricky; surely that would make someone
who's PROBEing the object to see how it works go crazy. :-)

Regards,
    Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

Reply via email to