by phoe-krk · 2y ago · 0 comments
I'm sometimes glad that the CL standard is frozen.
Sarcasm aside, this is literally https://xkcd.com/927/.
Sarcasm aside for real this time, getting this sort of binding mechanism in a COND-like form is unusual. This effectively means that a programmer needs to inspect all previous COND* forms, instead of relying on lexical scope AND indentation as they normally would, to see where new bindings are made. This is like Common Lisp's LOOP, but even there bindings are only allowed at the beginning of the loop, before any iteration clauses.
I also see a parallel to if/else if/else cascades. You can “break” and else if leg into … else { zzz; if (…) … } and then you can declare new variables at the zzz spot that are then available for the rest of the cascade.
I don’t know much about pcase and cond* so I can’t speak to the more general point. I just wanted to mention one specific aspect.
I miss emacs but as a Java developer what can you do…
In Scheme there is sometimes:
(define (foo)
(define a 10)
(+ a 42))
But even there all the embedded "define"s, by standard, need to be at the top of the body, directly at the start.