Skip to content

Commit

Permalink
Add a REPL.now method
Browse files Browse the repository at this point in the history
This would allow one to enter the REPL from a non-interactive program.
Ideally, this should be aware of its context, but apparently setting
$!save_ctx is not enough.  Maybe @vrurg has some ideas about that.

Sorta inspired by some comments on the #raku channel today.
  • Loading branch information
lizmat committed May 18, 2021
1 parent b1e4350 commit e0a9c4c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core.c/REPL.pm6
Expand Up @@ -440,6 +440,12 @@ do {

$!history-file.absolute
}

method now() {
my $repl := self.new(nqp::getcomp("Raku"),%_);
nqp::bindattr($repl,REPL,'$!save_ctx',nqp::ctxcaller(nqp::ctx));
$repl.repl-loop
}
}
}

Expand Down

0 comments on commit e0a9c4c

Please sign in to comment.