Skip to content

Commit

Permalink
Perlito5 - javascript data model: about compile-time lexicals
Browse files Browse the repository at this point in the history
  • Loading branch information
fglock committed May 9, 2012
1 parent b8def8a commit 47648d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README-perlito5-js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ https://github.com/audreyt/pugs/tree/master/perl5/PIL2JS

* Compile-time / Run-time interleaving (TODO)

- See perlref:
named subroutines are created at compile time so their lexical variables
get assigned to the parent lexicals from the first execution of the parent
block.
If a parent scope is entered a second time, its lexicals are created again,
while the nested subs still reference the old ones.


---
$ perl -e ' use strict; { my $x = 3; sub z { 123 } BEGIN { print "$x ", z, "\n" } INIT { $x = 4 } print "$x\n" } '
123
Expand Down

0 comments on commit 47648d1

Please sign in to comment.