3 ms·
Thanks so much for the extensive reply! There’s a lot to chew on in there. I think I’d be comfortable implementing the first kind of macro (switch-key) in my
by filoeleven 5y ago
Thanks so much for the extensive reply! There’s a lot to chew on in there.
I think I’d be comfortable implementing the first kind of macro (switch-key) in my own programs because it’s quite targeted in its goal and encapsulates some stuff to make the overall flow more readable. This makes sense to me, and I’m thinking about how they could improve my learning project. I probably just have to try sprinkling some in to get a better feel for them.
Your second example (define-event) is more foreign to me, likely because I’m working in Clojure. Compile-time correctness checking isn’t really a thing there, and debugging is improving but (from what I hear) nothing like other Lisps. That leaves using imperative macros to create top-level functions / classes / hash table entries, and that’s beyond my current level of need/understanding and may not be idiomatic for the language. I don’t know enough to say for sure.
Your last example definitely illustrates “prefer data over functions over macros.” Your estimate of 20 functions : 1 macro is also good evidence for at least the second half of that, too.