← All programs · Programs that must fail

Programs that must fail #4

✓
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

sub f() is definitely-not-a-trait { };

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!=== Error while compiling invalid-00000043.raku
Can't use unknown trait 'is' -> 'definitely-not-a-trait' in sub declaration.
at invalid-00000043.raku:1
    expecting any of:
        rw raw default DEPRECATED inlinable onlystar export leading_docs
        trailing_docs revision-gated implementation-detail hidden-from-backtrace
        hidden-from-USAGE pure nodal equiv tighter looser assoc prec

Raku++ 5.0.0-g312cde8e

Can't use unknown trait 'is' -> 'definitely-not-a-trait' in sub declaration.
  (X::Comp::Trait::Unknown)
  in block <unit> at invalid-00000043.raku line 1
      1 | sub f() is definitely-not-a-trait { };

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