4 ms·
> Just what kind of community treats its newcomers by ... telling them to go read Lisp macros? Macros (and DSLs) are more like their own little languages than
by derefr 13y ago
> Just what kind of community treats its newcomers by ... telling them to go read Lisp macros?
Macros (and DSLs) are more like their own little languages than they are like simple functions. To understand a macro on a fundamental level, you have to feel the need which suggested its creation. And the simplest way to do that, I think, is to read the macro's definition, to see what the code would look like without the macro there to clean it up.
This means, though, that to the extent that a library is definted in terms of macros, you have to meditate upon that library to understand not just how it was written, but why. This is the barrier macros create: without them, you can wave around other people's APIs and code in a cargo-cult fashion, and you'll probably get what you want. Macros prohibit cargo-culting a solution together: you actually have to understand the goals the library was built to serve.
- cynicalkane 13y agoThis is exactly the response that is a bad response. All the OP needed is an explanation of the syntax of a Compojure macro. If someone is asking about the syntax of a specific macro, then "you don't understand macros" is not the correct response. And that sort of thing doesn't work anyway for 90% of people.
- derefr 13y agoThat's what I was saying--macros don't work for 90% of people, because 90% of people aren't willing to read the libraries they use. (I'm not a Clojure user, if you're curious.)
- cynicalkane 13y agoThe last time I checked, Compojure didn't have a formal description of its core macros. This might have changed. Anyway, macros are easy to understand. They're hard to grok, but easy to understand. Generally you grok things by using them.