Hacker News new | past | comments | ask | show | jobs | submit login

Actually I never took the argument 'avoid macros unless absolutely needed' seriously. Macros are sexy and fun to code. The ease of writing macros in a syntax-less Lisp is ubercool. And programming should be fun, right?

I code in Ruby using monkeypatches and dirty hacks. I mostly use functional style with lots of blocks and lambdas and rarely write a proper class. So I'm a programming language power abuser, and proud of it ;)

But here I'm talking about a cognitive experience of reading code written some time ago or by someone else. Let's say that with macros/metaclasses/DSLs you prepare some environment to make your final code more spicey, and then you write that final code. My conclusion is that for Clojure my reaction on reading such code was usually "WTF?!?", and for Ruby: "Ahhh that's clear".

Btw I wonder why someone downvoted my original comment..

[edit] One more thing on macros: the On Lisp book which is armed to the teeth with macros was the cause why I learned Lisps years ago :]




Certainly on my own projects any and all dirty hacks are fair game. When I work with others I try to avoid being cute for cute's sake. I suppose it's no great revelation that some prefer Ruby syntax to Clojure's. However, I can say that Clojure works hard to reduce the number of parens that you might find in similar Lisp or Scheme code. For example, the `let` form in Common Lisp looks like:

    (let ((a 10) (b 20)) (* a b))
After many years using CL in school I can sympathize with the idea that Lisp is full of parens. Common Lisp's `let` is nicely delineated and is easy to reason about... for macro writers. Experienced Lisp users don't blink an eye at this. However, Clojure takes a different approach:

    (let [a 10, b 20] (* a b))
There are still parens, but they've been reduced leading to (IMO mind you) a cleaner look. Our opinions clearly differ on aesthetics, but I think it's worth noting that Clojure libraries will strive for the latter over the former.


It's true that average Clojure code looks cleaner than average CL code. Still I'm looking for something more cleaner, still being a Lisp. Time for Arc maybe :]


I wish I could speak for Arc, but sadly I can't say that I know more than superficialities. Hopefully someone else can chime in. Let me say that the example with `let` is just a small example of an over-arching trend in the way Clojure code looks vs. CL. I would love to hear more about Arc's approach.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: