Hi Andrew

Well, the TWO hash is not a problem and has always been this way. Remember
that every object! has the reference 'self as its first element. Second
returns a block with the values of every set-word in the object including
the complete object as the value of 'self. Probe avoids showing the value of
'self.

It is interesting that second shows the actual hash as having the value
[...] which is the new indicator for a recursive block, hash, list, object,
etc. Probe shows the actual value, as does

>>mold second second o

It would be nice to hear from RT as to whether the [...] in your example is
the intended behavior.

In any case, everything about the object and it use is functional, it can be
saved, loaded, etc. You can bind to the hash, etc.

BTW The same thing happens with when you put a block, list, or another
object in the outer object.

Here is a related fun puzzle ;-)

>> b: [1 2]
== [1 2]
>> b/2: b
== [1 [...]]
>> save %junk.txt b
>> b2: load %junk.txt
== [1 [...]
]
>> second b
== [1 [...]]
>> second b2
== [...]
>> first second b
== 1
>> first second b2
== ...

So it is possible to create a block which cannot be saved and loaded. This
may be a bug in load. Only RT knows what lurks in the heart of REBOL. ;-)

Cheers
-Larry

PS You can make a recursive block which cannot be saved and loaded.
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, October 05, 2000 8:40 PM
Subject: [REBOL] Bug! - 'second on object containing ONE hash! has TWO hash!
!!


> Bug! - 'second on object containing ONE hash! has TWO hash! !!
>
> REBOL/View 0.10.35.3.1 30-Sep-2000
> Copyright 2000 REBOL Technologies.  All rights reserved.
> >> o: make object! [h: make hash! []]
> >> o/h
> == make hash! []
> >> second o
> == [
>     make object! [
>         h: make hash! []
>     ] make hash! [...]]
> >> append o/h 1
> == make hash! [1]
> >> second o
> == [
>     make object! [
>         h: make hash! [1]
>     ] make hash! [...]]
> >>
>
> I'm fairly sure that this line:
>         make hash! [...]
>     shouldn't be present in 'o.
>
> Andrew Martin
> ICQ: 26227169
> http://members.nbci.com/AndrewMartin/
> -><-
>
>

Reply via email to