>Jakob Hede Madsen wrote
>
>>  Oh, and by the way: Even "Scripts" are instances themselves, so
>  > beware, but that's another story.

put script "parent"
-- (script "parent")
put new (script "parent")
-- <offspring "parent" 1 13504630>

We have two different things here.

The script value is the owner of the Lingo bytecode.

The instance/offspring stores the properties and their values, and 
also a pointer to the parent script, but not the actual bytecode 
which is stored with the parent #script object

So #script and #instance are two different things.

But you are right as you can use the two the same way. For example 
you can change the content of the properties of a parent script like 
you do with a child instance:

-- parent
property one

on new me
    one = void
    return me
end

and in the message window:

x1 = script "parent"
x1.one = 1
x2 = new (script "parent")
x2.one = 2

put x1.one && x2.one
-- "1 2"

This means that in fact the #script object is a pointer to a memory 
zone with space not only for the bytecode of the Lingo script *but* 
also for the properties and their values.

So it is in that sense that is right to say that #script objects are 
#instance objects themselves, because you can use them the same way.

But you could also say the reverse: #instance objects are the same 
than #script objects, the only difference been that the bytecode is 
stored with the #script and the #instance objects don't duplicate it, 
keeping only a pointer to the parent #script.
-- 

Daniel Devolder

Check my vList Xtra for saving Lingo values and lists with optional 
ZIP compression and encryption

http://www.updatestage.com/xtras/vlist.html

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to