Hacker News new | ask | show | jobs
by yoklov 5051 days ago
While I don't disagree on your other points, lisp's parentheses aren't just for the convenience of the parser, they're also for the convenience of the programmer who uses macros. Homoiconicity is a huge boon there.

Try using another language which allows macros and you'll see what I mean. For example, Haxe allows macros, and while it's syntax for them has recently improved, it still has a ways to go. Here's an example macro which checks if its argument is a constant string, and if it is, reads the file it represents. http://haxe.org/manual/macros/#manipulating-expressions

edit: The equivalent in clojure would be something like

    (defmacro get-file-contents [s]
      (if-not (string? s)
        (throw (Exception. "Expected string"))
        (slurp s)))
Which happens to look very similar to a function that does the same thing, but at runtime instead of at compile time.
1 comments

The haxe macro reads the file at runtime. Your clojure macro reads the file at compile-time. The proper version would be :

    (defmacro get-file-contents [s]
      (if-not (string? s)
        (throw (Exception. "Expected string"))
        `(slurp ~s)))
Nope, the Haxe program reads and includes the file at compile time, but only if it's a string literal. If it's an expression that evaluates to a string (which only works if you have static typing, as Haxe does), it reads it at runtime. If its neither it fails.