[REBOL] Re: Back to the Advanced Port stuff again
From: al:bri:xtra at: 11-Jan-2001 19:47
Paul Tretter wrote:
> Lets forget about alternative methods for doing this another way for a
moment and explain where I can find the word that is bound to the port
object given only the object. This is really what I seek to know.
> Maybe you miss my point Andrew. What if you dont know its "paul" or know
at all. In other words your at the discretion of the script working in a
block of ports assigned dynamically.
Here's something simple to illustrate:
>> o1: make object! [m: "Object one!"]
>> o2: make object! [m: "Object two!"]
>> One: o1
>> Two: o2
>> o1
>> probe o1
make object! [
m: "Object one!"
]
>> probe One
make object! [
m: "Object one!"
]
Both 'o1 and 'One refer to: make object! [m: "Object one!"]. Both 'o2 and
'Two refer to: make object! [m: "Object two!"].
Now given the object containing [m: "Object one!"], can I find out what
word(s) are refering to it? No, not _directly_. But if one is busy assigning
words to objects, one should also store them so they can't "get away". For
example:
>> B: make block! 0
== []
>> append B 'One
== [One]
>> append B 'Two
== [One Two]
>> B0: reduce copy B
== [
make object! [
m: "Object one!"
]
make object! [
m: "Object two!"
]]
>> b0
== [
make object! [
m: "Object one!"
]
make object! [
m: "Object two!"
]]
>> b
== [One Two]
In 'b are the words and 'b0 are the objects. Unless you shuffle or sort the
blocks, B/1 and B2 still refer to their objects:
>> probe get b/1
make object! [
m: "Object one!"
]
>> probe get b/2
make object! [
m: "Object two!"
]
If you still have problems, please let us know. I hope that helps!
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/