[REBOL] Bug! path! in objects don't behave the same as path! outside object Re:
From: rebol:techscribe at: 24-Sep-2000 21:48
Hi Andrew,
you wrote:
>Bug! path! in objects don't behave the same as path! outside object.
Which parallel case involving paths are you thinking of?
Here is an example case that does not involve objects at all and behaves
exactly the case you attribute to objects:
>> base: func [/p] [ either p [print "'p in 'base."] [print "'base"] ]
>> base/p
'p in 'base.
>> derived: make function! [/p] [ either p [p: first [base/p]] [first
[base] ] ]
>> derived
== base
>> derived/p
== base/p
When you create the object (or in my example the function) the expression
first [base/p]
is evaluated. It evaluates to the path base/p
>> type? first [base/p]
== path!
base/p is a value of type path! This value, base/p, is referenced by p in
your make object! example. If you want REBOL to instead assign p as a
reference to the value that the path evaluates to, you must tell REBOL that:
>> first reduce [base/p]
'p in 'base.
i.e.
derived: make object! [
p: first reduce [base/p]
]
>REBOL/View 0.10.34.3.1 23-Sep-2000
>Copyright 2000 REBOL Technologies. All rights reserved.
>>> base: make object! [
>[ p: does [print "function 'p in 'base"]
>[ ]
>>> derived: make object! [
>[ p: first [base/p]
>[ ]
>>> p: first [base/p]
>== base/p
>>> p
>function 'p in 'base
>>> :p
>== base/p
>>> base/p
>function 'p in 'base
>
>>> derived/p
>== base/p
>
>The above is incorrect, I believe. The result of the above should be the
>result of base/p:
> function 'p in 'base
> _not_ the path:
> base/p
>
>Andrew Martin
>ICQ: 26227169
>http://members.nbci.com/AndrewMartin/
>http://members.xoom.com/AndrewMartin/
>-><-
>
;- Elan [ : - ) ]
author of REBOL: THE OFFICIAL GUIDE
REBOL Press: The Official Source for REBOL Books
http://www.REBOLpress.com
visit me at http://www.TechScribe.com