[EMAIL PROTECTED] wrote

> I am not much into the theory of OOPs, but it seems that you are wrong
> about the object reference being erased when the timeout is forgotten. You
> will need to assign the object to a variable by using a return statement
> and explicitly set the variable to void later. The timeout is a property of
> the object, not the object itself. An object can have a property that is
> void. So deleting the timeout does not free up space taken up by the
> object.
> As far as I know, erasing the reference to the object isn't done
> internally. Objects dont commit suicide!!! :-)

Hi,

Yes, normally you would assign the object instance to a variable by using a
return statement. However, doing that is not essential - provided that the
object is referenced somewhere, the object instance will live. For example,
this will work

on new me
  global ObjectRef 
  ObjectRef = me   -- a reference is made, the object will live
end

In the example I posted earlier, having the script object create a timeout
which contains the only reference to the script object is sufficient to keep
the script object alive and kicking.

I am not sure what you mean by "The timeout is a property of the object, not
the object itself". The timeout object's name is referenced by a property of
the script object, but the timeout is still an object in its own right --
with its own unique properties and a timeoutList to live in. In fact, the
existence of the script object depends on the timeout object, not the other
way around. So long as the timeout exists and its target is the script
object, you cannot destroy the script object (though you can void all the
other references to it, the reference to the script object in the timeout
object will keep it alive and in memory)

Nevertheless, thanks for your comments -- trying to convince objects to
gracefully commit suicide is one of those little things I try and do every
now and again (I'm still jaded from the old days when having a factory
object remove itself from the actorList during stepframe would cause all
sorts of problems)
 
Luke


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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