Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[io grant] Allow no-arg &prompt
It's not entirely unheard of to not want to include any text message
to the user when prompting for some input. It's a bit antisocial to
force the user to specify `''` arg for such cases.

Worse, they might introduce a subtle bug into their code by switching
to use `get` for a message-less `prompt`, but `get` defaults to
`$*ARGFILES`, instead of `$*IN`
  • Loading branch information
zoffixznet committed May 22, 2017
1 parent b43db63 commit 0646d3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/io_operators.pm
Expand Up @@ -80,7 +80,10 @@ sub gist(|) {
!! nqp::p6bindattrinvres(nqp::create(List), List, '$!reified', args).gist
}

sub prompt($msg) {
multi sub prompt() {
$*IN.get
}
multi sub prompt($msg) {
my $out := $*OUT;
$out.print($msg);
$out.flush();
Expand Down

0 comments on commit 0646d3f

Please sign in to comment.