This would be fairly easy to do.

What you need to do is create a function that declares exactly what it 
depends on, then, you manually serialize everything in the origin, even the 
"free vars"


(function outer(foo,bar,baz){     // foo, bar, and baz are injected JSON 
strings

    return function yourSerializedFunction(){
         
             //foo, bar, and baz are available here, but you need to call 
JSON.parse on them

    }

})( 

  '{"foo":"is-serialized"}',
   '{"bar":"is-serialized"}',
   '{"baz":"is-serialized"}',

)

the above would have to happen in the origin

you're welcome :)



On Tuesday, June 8, 2010 at 1:09:19 PM UTC-7, Jacob Rothstein wrote:
>
> Hi all,
> This is a totally naïve question coming from someone who doesn't
> understand the inner workings of node/v8.  Is it possible to serialize
> a closure, including bound scope? For now, I'm not particularly
> concerned with how compact the serialized representation is.  Is it
> possible?
>
> For an example use case, I'd like to be able to take a function with
> bound vars, run it through this magic serialization engine, throw it
> into a queue, and have another worker on another machine deserialize
> and execute it.  Sound interesting?
>
> Happy nodeing,
> –Jacob
>
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/db1bbc68-a1f3-40f8-a046-919304f78920%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to