Skip to content

Commit

Permalink
Add RAKU_REPL_OUTPUT_METHOD environment variable
Browse files Browse the repository at this point in the history
When set, it should contain the name of the method with which the
value of an expression should be output.  The default is "gist",
which is the current state.  Expected alternate values are "raku"
and "Str".  But of course you can go crazy in this, and some of
you probably will.

This in response to the discussion in:

   Raku/problem-solving#194

Please revert if consensus is that this is a bad idea.  Personally
I would probably use RAKU_REPL_OUTPUT_METHOD=raku by default, but
that is just me :-)
  • Loading branch information
lizmat committed May 21, 2020
1 parent 12f8f1e commit 285717a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core.c/REPL.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,13 @@ do {
}

method repl-print(Mu $value --> Nil) {
nqp::can($value, 'gist')
and say $value
my $method := %*ENV<RAKU_REPL_OUTPUT_METHOD> // "gist";
nqp::can($value,$method)
and say $value."$method"()
or say "(low-level object `$value.^name()`)";

CATCH {
default { say $_ }
default { say ."$method"() }
}
}

Expand Down

0 comments on commit 285717a

Please sign in to comment.