← All programs · Programs that must fail

Programs that must fail #11

✓
Both compilers refuse this program — correctly

The program is broken on purpose. The right behaviour is a compile-time error instead of output, and that is what both compilers give.

The program

my $value = rx/ [ /;

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.08

(printed nothing)

Raku++ 5.0.0-g312cde8e

(printed nothing)

Error messages

Rakudo 2026.08

===SORRY!===
Null regex not allowed. Please use .comb if you wanted to produce a
sequence of characters from a string.
at invalid-00000050.raku:1
------> my $value = rx/ [ <HERE>/;
Unable to parse expression in metachar:sym<[ ]>; couldn't find final ']' (corresponding starter was at line 1)
at invalid-00000050.raku:1
------> my $value = rx/ [ <HERE>/;
    expecting any of:
        infix stopper

Raku++ 5.0.0-g312cde8e

===SORRY!=== Parse error at line 2: Couldn't find terminator / (corresponding / was at line 1)
  at invalid-00000050.raku:2

The wording of an error message is up to each compiler; what matters is that both refuse the program.