Hacker News new | ask | show | jobs
by andreareina 2058 days ago
'unless vs 'if-not vs 'negat-if is "just" a naming issue, it's the same in any other language wrt functions. IME a bigger issue is jumping between code and data, both for the writer of the macro (viz macros to ensure that a form is evaluated at most once) and the user (is this thing a macro? Is this form going to be evaluated or quoted?).

The benefit is being able to extend the language. Context managers in Lisp are just macros. Clojure's spec and async are macros.

For sure, the joke about blowing your whole leg off (as opposed to just your foot) applies, but it's the same for concurrency, distributed systems, cryptography, etc. The answer isn't to ban it, it's to exercise more care in the construction of these abstractions so that mere mortals can use them safely.

1 comments

Julia seems to get around this by making macro syntax explicit [1]: e.g. the macro "code_native" is used as @code_native (expr)

This makes macro wizardry easier to spot, but restricts how "plastic" the language is somewhat.

https://docs.julialang.org/en/v1/manual/metaprogramming/