3 ms·
The main issue with fexprs is that while it is neat way to generalize straightforward interpreter it makes implementation of compiler (or in fact almost anythin
by dfox 5y ago
The main issue with fexprs is that while it is neat way to generalize straightforward interpreter it makes implementation of compiler (or in fact almost anything requiring code walking, including some more advanced macros) unnecessarily complex or even impossible.
On the other hand, anything that you can do with fexprs can be implemented by macro if the macro facility offers some way of accessing the outer lexical environment (and there is not that many situations when you need that).
- sparkie 5y agoA key difference is that an fexpr can access its caller's dynamic environment, which obviously, must happen at runtime and cannot be reasoned about statically. There are plenty of opportunities to access the caller's environment once you get used to having the ability to do so. I find macros far less intuitive than I do Kernel's operatives, but as you've mentioned, this comes at the cost of performance with the inability to compile the code.