4 ms·
Semi-fanatic lisper here. First of all, search the other comments for a discussion of f-exprs. I was not familiar with Rebol before this article, but this aut
by aidenn0 11y ago
Semi-fanatic lisper here. First of all, search the other comments for a discussion of f-exprs.
I was not familiar with Rebol before this article, but this author shows a very good understanding of metaprogramming and homoiconicity, if they picked up this much about lisp macros without having used lisp previously.
Something that throws a lot of people new to common lisp is that macros are so powerful that they seem like magic, when they are probably the simplest metaprogramming tool around. In fact a big part of why I find CL to be such a high local maxima is the very high power/complexity ratio.
Complicated metaprogramming techniques tend to have either high compile-time overhead, high run-time overhead, or both. Sometimes efficient implementations can be discovered with the application of a large number of PhDs.
Lastly, I want to point out that bolting on a full-code walker to Common Lisp is not possible to do in a fully portable way (and by "fully portable" I mean "will run on any future conformant CL implementation"). This is due to the fact that conforming implementations are allowed to expand macros (and even special forms) from the standard into code that contains non-standard symbols.
Obviously you can do code walkers that are portable across N existing implementations with O(N) amount of programming effort; see cl-cont[1] for an example of this.
On the other hand, it would be very doable (if not quite trivial) to implement something in CLOS that works like a code-carrying closure that allows recompilation with declarative scope.
I do sometimes miss the fact that EVAL doesn't take an environment. The upside is that judging by questions I've seen in #lisp, if it did have such a construct, there would be a lot of fairly spaghetti-like EVAL code when a two-line macro would do the trick, as EVAL is the more obvious tool for code-as-data when macros are simpler and easier to understand.
1: http://quickdocs.org/cl-cont/api http://quickdocs.org/cl-cont/api