I'm trying to solve this issue, which mentions that the description of X::TypeCheck::Splice
exception in this page is wrong. This is the code:
use experimental :macros;
CATCH {
# will definitely catch all the exception
default { say .^name, " → ", .Str; }
}
macro a { 'foo' };
say a;
Which I have expanded to include the CATCH
block. However, an exception gets thrown:
===SORRY!===
Too few positionals passed; expected 3 arguments but got 2
However, I don't know if it's the correct type since it's not caught by the CATCH block. I have also tried to insert that block into CHECK
or BEGIN
phasers, which occur in compile time, to no avail. Any idea?
Apparently, other languages like clojure let the macro handle its own exception. That does not seem to work here; inserting the CATCH block inside the macro definition throws a WARNING, and kind of works (would print Nil
), which probably means it's catching the exception, but still does not print the exception type.