Extend your language
Writing the conditional blocks is no problem, since there's no distinction between built-in closures and user-defined. The if2
is currently just a function call, which requires a comma after the second condition; eventually we will be able to drop that in user-defined code, but none of our implementations can define parse actions in the statement_control category quite yet. (That syntax is special insofar as it's the only place Raku allows two terms in a row.) So currently it requires the comma until the implementations catch up with the spec on that subject.
This solution is hygienic in both lexical and dynamic variables; the only caveat is that the user's program must avoid the dynamic variable being used by the implementation of conditional, $*IF2
. This does not seem like a great hardship. (The conditionals will also nest correctly since that's how dynamic variables behave.)
Output:
Last updated