I is important not to fall into a trap that things always work the way they
are supposed to work.

The DynAPI have had huge problems with memory leaks because everyone assumed
that the automatic garbage collection works.

Thanks to a lot of the clever guys here at the list it was figured out that
the world isn't that perfect. So you need to do a lot of work for the
garbage collector (using the delete operator) for all memory to avoid leaks.

/Lasse

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Joachim
Lundgren
Sent: Tuesday, June 19, 2001 8:15 PM
To: [EMAIL PROTECTED]
Subject: [Dynapi-Dev] About "delete obj"


Sorry to jump in after this issue has been debated to a halt, but I have
been busy.

About the "delete" operator...

Microsoft's documentation:
http://msdn.microsoft.com/scripting/default.htm?/scripting/jscript/doc/jsopr
Delete.htm

Netscape's documentation:
http://developer.netscape.com/docs/manuals/js/core/jsref14/ops.htm#1045837

JavaScript 2.0 (very similar to ECMAScript Edition 4), both yet to be
finalized:
http://www.mozilla.org/js/language/js20/index.html
Unfortunately this is the specification, not the documentation, so it can be
quite difficult to read.

And now to my interpretation of it all...

The "delete" operator removes a property from an object (the close
relationship between arrays and objects makes this apply to arrays as well).

Netscape also allows "delete obj" under special circumstances and I imagine
this is due to where the "object" (actually the property) is stored. If you
look at Netscape's doc you see it won't function if you declare the object
with "var", and without it it ends up as a property of the "window" object
which would be why it works in that case.

One could easily believe new/delete are opposites as in other languages (ie.
C++) but because of the automatic garbage collection that isn't necessary,
and "delete" was therefor given a different meaning.

/Lunna






_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev

Reply via email to