# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #123419] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=123419 >
<masak> m: CHECK { say "switching to runtime" }; foo(); macro foo() { say "OH HAI" } <camelia> rakudo-moar 3fa1bd: OUTPUT«switching to runtimeOH HAI» <masak> TimToady: what should the semantics be of a macro that's called before its declaration? error at CHECK time? <masak> TimToady: I think the above semantics is basically an emergent accident, and should be fixed. <masak> it's too surprising that the exact same statement might meant two wildly different things depending on whether it comes before or after its definition. <jnthn> masak: I'm inclined to agree <masak> ok, that's good enough for me. <masak> spec clarification coming up. <jnthn> m: say A; class A { } <camelia> rakudo-moar 3fa1bd: OUTPUT«===SORRY!=== Error while compiling /tmp/5iWGahghKEIllegally post-declared type: A used at line 1» <jnthn> I think given a macro is als something effective at compile time, we can argue it along the same lines as this <jnthn> And maybe even implement it using the same mechanism. <dalek> specs: 272d12f | masak++ | S06-routines.pod: <dalek> specs: clarify that macros can't be called before they're defined <dalek> specs: review: https://github.com/perl6/specs/commit/272d12fc84 <masak> ...and because it's now spec... :) * masak submits rakudobug To be clear, I would expect calling the macro `foo()` to result in an error similar to the use of `A` before its definition.