3 ms·
> It also makes code generation easy, though I've never taken full advantage of it; I bet you have because Hiccup is an HTML DSL! Compojure is likewise a DSL f
by JamesLeonis 3y ago
> It also makes code generation easy, though I've never taken full advantage of it;
I bet you have because Hiccup is an HTML DSL! Compojure is likewise a DSL for building Ring handlers based on HTTP request types.
But to your larger point, I also find I don't reach for macros at all. Looking carefully, I think this is because we have first-class syntax for vectors and maps, and those containers are very flexible about the type of their contents. Combined with the Seq abstraction and a well equipped standard library most Clojure code I write is macro-free.
- maxfurman 3y agoPerhaps I'm being pedantic, but `if` and many other control-flow constructs are implemented as macros in Clojure. So you probably use macros a lot!
- bcrosby95 3y agoSo everyone uses C.
- User23 3y agoSBCL is self-hosting. It feels like a bit of a stretch to say syscalls are macros, but if you really want to torture language that way then sure because the kernel is mostly C.
- deleted 3y ago[deleted]
- kagevf 3y agoIn CL, IF is a special form and COND is a macro.
- rightbyte 3y ago> most Clojure code I write is macro-free. Conceptually, most forms that are not on the form (fn args...) are macros. You got like cond, lambda and label forms, that are not macros. I don't think Clojure technically has label forms though.
- JamesLeonis 3y agoYou are correct. I should have clarified. I meant I don't write many custom macros myself.