Hmm, yes I did test if the delete operation worked.

But I am getting some conflicting info regarding what the chrome
console can do opposed to what a base v8 build can do.

Suppose you test this:

V = {};
V.X = new Object("Test");

delete V.X; // returns true in chrome, false in the shell program
delete V;   // returns true in both;

V = {};
V.X = new Object();
delete V.X // Returns true in both
delete V; // returns true in both

// Native testing with v8
V = {};
V.X = new EventEngine();
delete V.X; // false;
delete V; // true,

Now X is lost and dangling. The C++ destructor is never called, even
at program exit. Supposedly MakeWeak will take care of this but
possibly slow down v8?

On Jun 8, 10:18 pm, "Lasse R.H. Nielsen" <[email protected]> wrote:
> Kevin is absolutely correct. On top of that, you can actually check
> whether a delete operations works - it is an expression that evaluates
> to either true or false, depending on whether it manages to delete the
> property. In this case it evaluates to false, which you can see by
> doing, e.g.,
>   print(delete foo);
> in the shell.
>
> /Lasse
>
>
>
>
>
>
>
>
>
> On Thu, Jun 9, 2011 at 06:58, Kevin Millikin <[email protected]> wrote:
> > On Thu, Jun 9, 2011 at 4:05 AM, CodeJunkie <[email protected]> wrote:
>
> >> var evtMgr = new EventManager();
>
> >> and then turn around and do
>
> >> delete evtMgr;
>
> >> The object still exists.
>
> > Unlike C++, new and delete in JavaScript are not related to each other.  The
> > keyword new constructs a new object.  However, the keyword delete removes a
> > *property* from an object.  The value named by the property will not
> > necessarily be garbage collected---there may be other references to it.  The
> > value is normally not deallocated immediately in any case.
> > Properties introduced with 'var' are not deletable, so 'delete' correctly
> > does not delete the property.
>
> >> addition to this, any object or variable that i create by doing
> >> NS = {};
> >> delete NS;
>
> >> Works just fine and
>
> >> var foo = 20;
> >> delete foo;
>
> >> Does not remove the variable. Any thoughts on this?
>
> > Properties introduce with 'var' are not deletable.  Most other properties
> > are.
>
> --
> Lasse R.H. Nielsen
> [email protected]

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to