← All programs · Literals

Literals #2

!
Same output, different warnings

Both compilers print the same result, but Rakudo 2026.08 also writes a warning and Raku++ 5.0.0-g312cde8e does not. See the messages below. This difference is preserved as a Rakumap finding ↗

The program

The first lines compute $value. The last four lines are the same in every program: they print what kind of thing $value is, how it looks as code, as a string, and as true or false.

my $value = (True, False, Nil, Any, Failure.new("x").defined);

sub safe-str($v) { my $s = try $v.Str; $s.defined ?? $s !! '<undefined>' }
say "TYPE\t" ~ $value.^name;
say "RAKU\t" ~ $value.raku;
say "STR\t" ~ safe-str($value);
say "BOOL\t" ~ $value.Bool;

Run executes the program in your browser, with the Raku++ build this site ships. Edit it and try variations.

What each compiler printed

Rakudo 2026.08Raku++ 5.0.0-g312cde8e
Type .^nameListList
Code form .raku$(Bool::True, Bool::False, Nil, Any, Bool::False)$(Bool::True, Bool::False, Nil, Any, Bool::False)
String .StrTrue False FalseTrue False False
True or false .BoolTrueTrue

Errors and warnings

Rakudo 2026.08

Use of Nil in string context
  in code  at literals-00000041.raku line 3
Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
  in code  at literals-00000041.raku line 3

Raku++ 5.0.0-g312cde8e

(no error — the program ran to the end)