3 ms·
The Scheme dialect of Lisp is perhaps my favorite for how small the core is (and hygienic macros are an elegant solution to avoiding accidental captures). The R
by siraben 6y ago
The Scheme dialect of Lisp is perhaps my favorite for how small the core is (and hygienic macros are an elegant solution to avoiding accidental captures). The R5RS language report also specifies the formal denotational semantics of the language. But it's also more precise than McCarthy's presentation, the denotational semantics can be easily turned into a real, correct-by-construction interpreter[0].
[0] https://github.com/siraben/r5rs-denot https://github.com/siraben/r5rs-denot
- sillysaurusx 6y agoHygenic macros are a solution to a problem that doesn't exist, though. The whole point of macros is to control evaluation. Sometimes you want intentional capture; it's not accidental. Throwing out the chainsaw just because a few people use it improperly means you won't be able to cut trees so easily. But, different people can feel differently about it. :)
- db48x 6y agoI disagree. The hardest part about teaching macros in Lisp is teaching the hoops we much jump through using gensym to avoid accidents. It’s better that the compiler do that for us. And it’s not as if it is impossible to make a deliberate capture in Scheme; you just have to opt in to it, rather than carefully avoiding it in 99% of the macros that you write.
- bjoli 6y agoWhy do lispers believe that scheme can't introduce bindings? Every scheme has a lower lever hygienic macro facility that allows introducing bindings. R6rs has syntax-case. Others have explicit/implicit renaming or syntactic closures. Hygiene is opt-out (except maybe in explicit renaming), not opt-in like in common lisp. That is, IMO, a good thing.
- mst 6y agoGiven a decent percentage of my macros -don't- need capturing I quite like having a form available that's hygeinic out of the box to save me from capturing by accident. I would not at all be happy to not have a facility to do capturing as well, though.
- wtetzner 6y agoScheme gives the ability to capture where you want to. You just have to be explicit about it. Seems like the right default to me.