Created
July 28, 2017 12:10
-
-
Save bduggan/24e71f65de0fdf641d72a59cdb748f61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nqp; | |
my $compiler := nqp::getcomp('perl6'); | |
my $repl = REPL.new($compiler, {}); | |
my $save_ctx = nqp::null(); | |
for ( '42', | |
'2+2', | |
'my $x = 2', | |
'$x', | |
'my $y:=3', | |
'$y' ) -> $code { | |
my $*MAIN_CTX; | |
my $*CTXSAVE = $repl; | |
say $repl.repl-eval: $code, my $exception, :outer_ctx($save_ctx); | |
$save_ctx := $*MAIN_CTX if $*MAIN_CTX; | |
} | |
# output | |
# 42 | |
# 4 | |
# 2 | |
# 2 | |
# 3 | |
# (Mu) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment