|
|
|
|
|
by kazinator
3671 days ago
|
|
> If Hoon did have macros, however, they would be inherently hygienic, without anything like a gensym Everything we know about hygienic macros is mainly the result of research in Lisp dialects. Everything that has syntax has macros. Just not necessarily user definable macros. Syntax takes some clumps of symbols and converts them to some other symbols. When that is user-defined, we call it a macros; when it is hard-wired in some parser, we call it a grammar production. "You don't need macros" is reminiscent of "why would you need more than 640 Kb of RAM?" If you don't need macros, it means that the language syntax has provided exactly the right set of hard-coded ones in the parser. If that is true, why are there different languages without macros with different syntaxes? And which one is right? |
|
The advantage of fixing the set of hardwired macros is that, when reading code, everyone knows exactly what every line is doing, without having to indirect through the local macro environment. Macros are the first step toward a DSL.
DSLs are always and everywhere a bad idea. They may make code slightly cleaner or better-looking. In exchange, they add a level of indirection to the task of trying to understand it. This is the source of the nickname "write-only code," a common failure mode in FP. Write-only code can also be created by extravagant and pointless use of higher-order or non-strict programming, both of which complicate the task of reading code.
For instance, Hoon has a rune (keyword or digraph) for a 2-tuple, a 3-tuple, a 4-tuple, but not for a 5-tuple or up. Why? The 4-tuple cons pulled its weight, the 5-tuple didn't. For every special form you add to Hoon's fixed, limited set, you're imposing a cost on anyone who has to learn Hoon.
I hope you can see the UI advantage to functional programming in an environment of controlled evaluation complexity. IMHO, too much of FP is a world in which every program is its own language.
Which one is right? Actually, I feel it's possible that the only real language is K, and the rest of us are just phonies.