Rules / Types, classes & roles / exception

X::TypeCheck::Splice Reference

Compilation error due to a macro trying to splice a non-AST value

What it is #

Routines #

Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.

method action #

method action(--> Str:D)

Returns Str:D.

Returns a verbal description of the action that triggered the error, "macro application" or "unquote evaluation".

Examples, run three ways #

Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.

3 no-output · 1 rakupp-differs

class X::TypeCheck::Splice is X::TypeCheck does X::Comp { }

Not executed: the documentation states no expected output for this example.

use experimental :macros;
macro quasi-ast { quasi { {{{'not AST'}}} };};
say quasi-ast;

Not executed: the documentation states no expected output for this example.

Type check failed in macro application; expected AST but got Str("not AST")

Not executed: the documentation states no expected output for this example.

use experimental :macros;
macro an-ast {
quasi { 'yes AST' }
}
say an-ast;              # OUTPUT: «yes AST␤»
Documentation
yes AST
Rakudo
yes AST
Raku++

Raku++ disagrees with both the documentation and Rakudo — a defect.