On Wednesday, 26-August-2009 at 20:02:39 Giuseppe Chillemi wrote,

>> He's talking about the possibility of multiple variables 
>> pointing at an immutable value:
>> 
>> >> X: make object! [Name: {Spock}]
>> >> A: B: :X
>
>You are right !
>
>> Then, say, changing the object entirely:
>> >> X: make object! [Species: {Human}]
>> and having A and B now also point to the new object.
>
>You have interpreted correctly my message.
>
>> Here's a way to simulate it:
>> >> X: reduce [make object! [Name: {Spock}]]
>> >> A: B: X
>> >> X/1: make object! [Species: {Human}]
>> Now, A/1 and B/1 also point at the new object.
>
>I whish a more direct way able to be able to link to a function and have
>many object point to that function and reuse the code.

Ok. Try ALIAS...

>> alias 'x "aa"
== aa
>> alias 'x "bb"
== bb
>> x: make object! [name: "Spock"]
>> probe x
make object! [
    name: "Spock"
]
>> probe aa
make object! [
    name: "Spock"
]
>> probe bb
make object! [
    name: "Spock"
]
>> aa: make object! [species: "human"]
>> probe x
make object! [
    species: "human"
]
>> probe bb
make object! [
    species: "human"
]
>> probe aa
make object! [
    species: "human"
]

ALIAS only works if the words haven't already been used though. So this doesn't 
work...

>> alias 'bb "cc"
** Script Error: Alias word is already in use: cc
** Near: alias 'bb "cc"

-- Carl Read.

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to