Re: [nodejs] How to properly pass Local as function param?

Sun, 11 Nov 2012 23:51:51 -0800

You should probably just be using Handle<> in most of your function
parameters. The only reason to specify Local<> or Persistent<> instead of
the more generic superclass Handle<> is when you need to manage the
lifetime of the object. It's generally not the callee's job to manage the
memory of the underlying handle, so it doesn't need to know if a given
handle is local or persistent.

If it's async you should still probably use Handle<> for the argument, but
then you can create your own persistent reference to it via
Persistent<>::New(handle).


On Sun, Nov 11, 2012 at 7:34 PM, Ryan Cole <[email protected]> wrote:

> Ok thanks for the help. I think through this code I'm writing I've at
> least nailed down when to use those two handle types. Thanks again!
>
> Ryan
>
> On Sunday, November 11, 2012 9:19:44 PM UTC-6, Ben Noordhuis wrote:
>
>> On Mon, Nov 12, 2012 at 4:16 AM, Ryan Cole <[email protected]> wrote:
>> > Ok awesome, thanks for the reads. Also, just to deliberately ask, what
>> about
>> > in async function calls? I'm assuming I'd not use Local<Object>? For
>> > example, if I were using the baton pattern, would my baton struct use a
>> > Local<Object>? I've seen examples for callback functions that use
>> > Persistent<Function>, so that makes me think I'd use Persistent<Object>
>> to
>> > cross those function calls?
>>
>> Yes, Persistent<Object>.
>>
>  --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to