[REBOL] Bug! path! in objects don't behave the same as path! outside object Re:(
From: al:bri:xtra at: 25-Sep-2000 19:50
> Hi Andrew,
Hi, Elan.
I agree with everything up to here:
> 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]
> ]
Unfortunately, that doesn't work:
>> base: make object! [p: does [print "function 'p in 'base"]]
>> derived: make object! [p: first reduce [base/p]]
function 'p in 'base
** Script Error: p needs a value.
** Where: p: first reduce [base/p]
I'd like 'p in 'derived to be a path!, which refers to 'p in 'base. Like I
can do with 'p outside of derived. Watch closely:
>> p: first [base/p]
== base/p
>> type? p
function 'p in 'base
== unset!
>> type? :p
== path!
>> probe p
function 'p in 'base
** Script Error: probe is missing its value argument.
** Where: probe p
>> probe :p
base/p
== base/p
Now if this behaviour outside an object were implemented inside an object,
then it would be very easy to write objects that inherit behaviour, and the
storage cost wouldn't involve copying functions into every object. I think
that would be very nice behaviour. I can also show that it's fault in
objects because:
>> derived: make object! [p: first [base/p]]
>> derived/p: :p
== base/p
>> probe derived
make object! [
p: base/p
]
>> derived/p
== base/p
>> p
function 'p in 'base
Andrew Martin
Breaking new paths...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
http://members.xoom.com/AndrewMartin/