[v8-users] implementing ObjectTemplate HasInstance() method

2013-04-24 Thread Mike Moening
After digging into object construction using FunctionTemplate or ObjectTemplate in this post: https://groups.google.com/forum/?fromgroups=#!topic/v8-users/521aXb3Uer4 I believe the ObjectTemplate is missing a HasInstance() method for use in testing arguments to JS functions to be of a certain t

Re: [v8-users] How to test an Argument for InstanceOf() type

2013-04-24 Thread Stephan Beal
On Wed, Apr 24, 2013 at 1:18 PM, Ben Noordhuis wrote: > That's not another option - that's the same option. :-) > Yeah, technically. My point was only that it could some opaque pointer, e.g.: static int foo = 3; and pass a pointer to that. But yes, having it be a string makes debuggering easi

Re: [v8-users] How to test an Argument for InstanceOf() type

2013-04-24 Thread Ben Noordhuis
On Wed, Apr 24, 2013 at 12:28 PM, Stephan Beal wrote: > On Wed, Apr 24, 2013 at 11:00 AM, Ben Noordhuis wrote: >> >> ...The trick I mentioned in my other post is that you add a second >> internal field that points to some atom (usually a char >> class_name_id[] = "MyClassName") that you check for

Re: [v8-users] How to test an Argument for InstanceOf() type

2013-04-24 Thread Stephan Beal
On Wed, Apr 24, 2013 at 11:00 AM, Ben Noordhuis wrote: > ...The trick I mentioned in my other post is that you add a second > internal field that points to some atom (usually a char > class_name_id[] = "MyClassName") that you check for in your prototype > methods so you can be sure that args.This

Re: [v8-users] How to test an Argument for InstanceOf() type

2013-04-24 Thread Ben Noordhuis
On Wed, Apr 24, 2013 at 1:07 AM, Mike Moening wrote: > Ben, > > Can you expand on your example? > I'm sure this is piece of cake for you, but I'm not getting what you mean. > > All the samples I can find show using ObjectTemplate and the > SetCallAsFunctionHandler() to handle construction from the