[v8-users] Re: New feature: handle eternalization

2013-09-17 Thread Dan Carney
Handle will go away eventually.  New apis will use Local.  Old apis that 
use Handle will migrate to Local.  If you have a Handle, you'll have to do 
LocalX(handle) where needed.

On Tuesday, September 17, 2013 1:07:30 AM UTC+2, ioannis wrote:

 Shouldn't the use of Handle and Local be interchangeable ?
 Has it been decided which of the two will be depreciated in the end ?

 It seems that we cannot assign a Handle value to the Eternal and we need 
 to use Local instead ...


-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[v8-users] Re: New feature: handle eternalization

2013-09-16 Thread ioannis
Shouldn't the use of Handle and Local be interchangeable ?
Has it been decided which of the two will be depreciated in the end ?

It seems that we cannot assign a Handle value to the Eternal and we need 
to use Local instead ...

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[v8-users] Re: New feature: handle eternalization

2013-09-03 Thread Mike Moening
Found another bug in Eternal.

The IsEmpty() method is returning an inverted value.

Broken code:
V8_INLINE(bool IsEmpty()) { return index_ != kInitialValue; }

Should be:
V8_INLINE(bool IsEmpty()) { return index_ == kInitialValue; }

Here is the bug report:
https://code.google.com/p/v8/issues/detail?id=2870

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[v8-users] Re: New feature: handle eternalization

2013-08-29 Thread Dan Carney


 No extra object to keep around. Once the Local is saved as an eternal I 
 can get it back with a simple hash lookup (GetEternal())

 LocalObject local = LocalObject::GetEternal(isolate, 
 MY_OBJECT_TEMPLATE_ID );

 How does that sound?


The index is isolate specific and v8 itself uses some internally, so the 
value of the index cannot be exposed.  It's better than keeping a 
persistent around for cases where access times matter.  Getting a Local 
from an Eternal is very fast.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[v8-users] Re: New feature: handle eternalization

2013-08-29 Thread Mike Moening
Dan,

I think something is broken in the new Eternal API.
This example code block fails to compile.
Seems ObjectTemplate is missing a Cast method?

   EternalObjectTemplate eternal;
   LocalObjectTemplate tmplXFile;
   tmplXFile = eternal.Get(pIsolate);
   eternal.Set(pIsolate, tmplXFile);

V8\include\v8.h(406) : error C2039: 'Cast' : is not a member of 
'v8::ObjectTemplate'
V8\include\v8.h(3455) : see declaration of 'v8::ObjectTemplate'
V8\include\v8.h(5697) : see reference to function template 
instantiation 'v8::LocalT 
v8::LocalT::Castv8::Value(v8::Localv8::Value)' being compiled
with
[
T=v8::ObjectTemplate
]
V8\include\v8.h(5696) : while compiling class template member 
function 'v8::LocalT v8::EternalT::Get(v8::Isolate *)'
with
[
T=v8::ObjectTemplate
]
.\RXFile.cpp(452) : see reference to class template instantiation 
'v8::EternalT' being compiled
with
[
T=v8::ObjectTemplate
]
V8\include\v8.h(406) : error C2784: 'v8::LocalT 
v8::LocalT::Cast(v8::LocalS)' : could not deduce template argument for 
'v8::LocalS' from 'v8::Value *'
with
[
T=v8::ObjectTemplate
]
V8\include\v8.h(400) : see declaration of 'v8::LocalT::Cast'
with
[
T=v8::ObjectTemplate
]
V8\include\v8.h(6285) : error C2440: 'static_cast' : cannot convert from 
'v8::ObjectTemplate *' to 'v8::Value *'
Types pointed to are unrelated; conversion requires 
reinterpret_cast, C-style cast or function-style cast
V8\include\v8.h(5691) : see reference to function template 
instantiation 'v8::Value *v8::Value::CastT(T *)' being compiled
with
[
T=v8::ObjectTemplate
]
.\RXFile.cpp(455) : see reference to function template 
instantiation 'void v8::EternalT::Setv8::ObjectTemplate(v8::Isolate 
*,v8::LocalT)' being compiled
with
[
T=v8::ObjectTemplate
]

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[v8-users] Re: New feature: handle eternalization

2013-08-29 Thread Dan Carney



 I think something is broken in the new Eternal API.
 This example code block fails to compile.
 Seems ObjectTemplate is missing a Cast method?

 Yep.  I'll fix it tomorrow.  Thanks for the report. 

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[v8-users] Re: New feature: handle eternalization

2013-08-28 Thread Mike Moening
Dan, 

Did the new Eternal land yet?
I'm porting code now and would like to use it.

Mike M.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[v8-users] Re: New feature: handle eternalization

2013-08-28 Thread Mike Moening
It's getting clearer but less useful.

So the Eternal object stores the index for me. Right?
Doesn't that mean I have to now keep the Eternal object around in my code?
How is keeping an Eternal around better than keeping a Persistent around?

It would be nice if the user could specify the unique index of the eternal.
Then all I ever need to keep is a constant integer value.
const MY_OBJECT_TEMPLATE_ID = 12345;

No extra object to keep around. Once the Local is saved as an eternal I can 
get it back with a simple hash lookup (GetEternal())

LocalObject local = LocalObject::GetEternal(isolate, 
MY_OBJECT_TEMPLATE_ID );

How does that sound?

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [v8-users] Re: New feature: handle eternalization

2013-08-26 Thread Dan Carney


 Suggestion: lower the cognitive barrier, rename IsSet() to IsEmpty() -  


Thanks for the suggestion!  It will be in the next v8 release.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[v8-users] Re: New feature: handle eternalization

2013-08-23 Thread Dan Carney
We've discussed the api a bit more, and decided that it really needs to 
look more like Local and Persistent.  I apologize to anyone who may have 
already started to use the original api.  This change will land next week 
and will remove the original.

The new api is used as follows:


EternalFunctionTemplate eternal;



LocalFunctionTemplate function_template;
if (eternal.IsSet()) {
  function_template = eternal.Get(isolate);
} else {
  HandleScope scope(isolate);
  function_template = BuildFunctionTemplate();
  eternal.Set(isolate, function_template);
}



-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [v8-users] Re: New feature: handle eternalization

2013-08-23 Thread Ben Noordhuis
On Fri, Aug 23, 2013 at 8:58 AM, Dan Carney dcar...@chromium.org wrote:
 We've discussed the api a bit more, and decided that it really needs to look
 more like Local and Persistent.  I apologize to anyone who may have already
 started to use the original api.  This change will land next week and will
 remove the original.

 The new api is used as follows:


 EternalFunctionTemplate eternal;

 

 LocalFunctionTemplate function_template;
 if (eternal.IsSet()) {
   function_template = eternal.Get(isolate);
 } else {
   HandleScope scope(isolate);
   function_template = BuildFunctionTemplate();
   eternal.Set(isolate, function_template);
 }

Suggestion: lower the cognitive barrier, rename IsSet() to IsEmpty() -
unless it does something completely different from
HandleT::IsEmpty(), of course.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[v8-users] Re: New feature: handle eternalization

2013-08-11 Thread Dan Carney


 I can think of a case where i might want to destroy one.


Destronying a eternal can only be done via Isolate::Dispose() 

If you can think of a reason to destroy an eternal, you probably don't want 
one in the first place.  You probably want a strong Persistent and an 
explicit Dispose() somewhere.


-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[v8-users] Re: New feature: handle eternalization

2013-08-09 Thread Mike Moening
I know this may sound stupid... but how can I kill an eternal?
Really nothing lives forever.
I can think of a case where i might want to destroy one.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [v8-users] Re: New feature: handle eternalization

2013-08-09 Thread Stephan Beal
On Fri, Aug 9, 2013 at 8:54 PM, Mike Moening mike.moen...@gmail.com wrote:

 I know this may sound stupid... but how can I kill an eternal?
 Really nothing lives forever.
 I can think of a case where i might want to destroy one.


This should do the trick:

exit(0);

;)

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [v8-users] Re: New feature: handle eternalization

2013-08-09 Thread Michael Schwartz
Or this:

http://www.colourbox.com/preview/4529861-742962-big-hammer-for-industrial-work-vector-illustration.jpg

Also doubles as a PC card insertion tool.

On Aug 9, 2013, at 11:54 AM, Mike Moening mike.moen...@gmail.com wrote:

 I know this may sound stupid... but how can I kill an eternal?
 Really nothing lives forever.
 I can think of a case where i might want to destroy one.
 
 -- 
 -- 
 v8-users mailing list
 v8-users@googlegroups.com
 http://groups.google.com/group/v8-users
 --- 
 You received this message because you are subscribed to the Google Groups 
 v8-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to v8-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
v8-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.