Skip to content

Instantly share code, notes, and snippets.

@Benabik
Created April 25, 2012 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Benabik/2490722 to your computer and use it in GitHub Desktop.
Save Benabik/2490722 to your computer and use it in GitHub Desktop.
Dynamic Lexicals in PIR
.sub 'main' :main
.local pmc lex
.lex 'dynlex', lex
lex = new 'FixedStringArray', 2
lex[0] = 'main'
'test'()
say lex
'test2'()
say lex
.end
.sub 'test'
$P0 = find_dynamic_lex 'dynlex'
$P0[1] = 'test'
.end
.sub 'test2'
$P0 = new 'FixedStringArray', 1
$P0[0] = 'test2 rules'
store_dynamic_lex 'dynlex', $P0
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment