Hi Gabriele,

when you say

b: get in obj 'f

you are indeed creating a reference. This was not Andrew's concern. Andrew
was talking about the following situation:

>> ancestor: make object! [f: func [] [print "ancestor"]]
>> descendant: make ancestor []
>> ancestor/f
ancestor
>> descendant/f
ancestor

Now let us modify ancestor's f:

>> b: get in ancestor 'f
>> insert tail second second :b "-object"
== ""

Now you can see that when you create a descendant object, the actual
function is copied, not just a reference:

>> ancestor/f
ancestor-object
>> descendant/f
ancestor

ancestor/f displays the new string of f, but descendant's has remained
unchanged. It has its own copy of 'f.

Elan


At 02:58 PM 11/30/99 +0100, you wrote:
>[EMAIL PROTECTED] wrote:
>
>> Implementation: make object! [
>>         s: "This is s - a string"
>>         f: func [hello] [s]
>>         ]
>> 
>> Interface: make object! [
>>         ; f: get in Implementation 'f           ; Copies Implementation/f
>
>Actually, you get a reference to that function. You will not copy
>it.
>
>>> obj: make object! [
>[    f: func [] []
>[    ]
>>> b: get in obj 'f
>>> print mold :b
>func [][]
>>> insert second :b [print "Hello"]
>== []
>>> print mold :b
>func [][print "Hello"]
>>> print mold obj
>
>make object! [
>    f: func [][print "Hello"]
>]
>>> obj/f
>Hello
>>> b
>Hello
>
>Ciao,
>    /Gabriele./
>o--------------------) .-^-. (----------------------------------o
>| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
>| GIESSE on IRC     \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
>o--------------------) `-v-' (----------------------------------o
>
>
>

Reply via email to