4 ms·
Well, I like Lisp, too. But the macros are not really good, but they are basically buggy ('non-hygienic'), and it took a few years to realise and repair that.
by beeforpork 3y ago
Well, I like Lisp, too. But the macros are not really good, but they are basically buggy ('non-hygienic'), and it took a few years to realise and repair that. Look at Scheme or Racket instead.
- bitwize 3y agoCLers will be along to tell you that macro bugs rarely happen in CL because of separate function and variable namespaces, and if they do you can always use gensyms. CL is the "worse is better" of "the right thing".
- pfdietz 3y agoAs a CLer, I have never understood the draw of hygienic macros. They solve what looks like a non-problem, straining mightily to achieve little of actual value.
- Paul-Craft 3y agoIt turns out that it isn't terribly hard to implement hygienic macros on top of "non-hygienic" macros. I recently saw a paper that had an implementation. The code itself was fairly short.
- beeforpork 3y agoThat sounds like an interesting read. Can you post a pointer?
- Paul-Craft 3y agoI wasn't sure I could find it again, but here it is! Embedding Hygiene-Compatible Macros in an Unhygienic Macro System: https://www.jucs.org/jucs_16_2/embedding_hygiene_compatible_macros.html https://www.jucs.org/jucs_16_2/embedding_hygiene_compatible_... Abstract: It is known that the essential ingredients of a Lisp-style unhygienic macro system can be expressed in terms of advanced hygienic macro systems. We show that the reverse is also true: We present a model of a core unhygienic macro system, on top of which a hygiene-compatible macro system can be built, without changing the internals of the core macro system and without using a code walker. To achieve this, the internal representation of source code as Lisp s-expressions does not need to be changed. The major discovery is the fact that symbol macros can be used in conjunction with local macro environments to bootstrap a hygiene-compatible macro system. We also discuss a proof-of-concept implementation in Common Lisp and give historical notes. The code is in Figure 1, on page 10 of the PDF (p. 280 in the actual journal)
- beeforpork 3y agoGreat read, thanks!
- zetalyrae 3y agoHygienic macros are a waste of time. I've never once had a macro bug from CL.
- varjag 3y agoHygienic macros are a bigger issue in 1-lisps dude to high density of namespace collisions.