Search   Feed   Browse   Add
Feed items 1 - 2 of 2 for November 2006

Re: JS closures lose context by Andy Armstrong - November 4, 2006

On 4 Nov 2006, at 20:40, Andy Armstrong wrote:> It looks as if the context that should be captured (closed over) by > the returned JS function is being lost. Is this expected behaviourOh and the &39;return 1&39; in js_next was just me playing to find out exactly what was being lost - but it doesn&39;t affect the observed behaviour.-- Andy Armstrong, hexten.net
http://www.nntp.perl.org/group/perl.javascript/2006/11/msg52.html

JS closures lose context by Andy Armstrong - November 4, 2006

Given this code:----------------------------------------------------!usrbinperl -wuse strict;$ = 1;use JavaScript;my $rt = JavaScript::Runtime->new();my $cx = $rt->create_context();sub get_js my $next = 1; Make a perl function $cx->bind_function(perl_next => sub return $next++; ); $cx->eval(q function makeClosure() var next = 1; var js_next = function() return 1; return next++; .
http://www.nntp.perl.org/group/perl.javascript/2006/11/msg51.html
Available Archives
- March (1 item)
- June (4 items)
- November (2 items)
Sponsored Links
© 2008 FeedCapsule.com  |  Contact