3 ms·
My example is intended to be nebulously "Lisp". I did mean to mention in my comment that Common Lisp's packages help here (I'm usually frustrated in these disc
by groovy2shoes 10y ago
My example is intended to be nebulously "Lisp". I did mean to mention in my comment that Common Lisp's packages help here (I'm usually frustrated in these discussions when people are always like "Lisp2 Lisp2 blah blah" but that's only part of the story, imo packages play a bigger role), so thanks for pointing that out. I did, however, mention that CL doesn't let you rebind standard names, though.
My point wasn't "Common Lisp (or defmacro) bad, Scheme good", or that you can't write hygienic macros in Common Lisp[1], though it appears that I've come off that way. My point is just that `gensym` alone isn't enough for hygiene (in all cases).
[1]: Another thing that doesn't seem to be understood well enough in these discussions is that hygiene is a property of macros, not macro systems.
- qwertyuiop924 10y agoYou can gensym functions, you know. It's just a PITA. Take it from a CHICKEN user...
- groovy2shoes 10y agoTrue, you can, though I've never seen anyone actually do it. Not that I've read all the code out there or anything, far from it.
- qwertyuiop924 10y agoIn chicken, you have to (r) all your functions (the rename function is passed to the function transformer, but it's called r, or rename, by convention) if you're writing an er macro, which is what you do if you want expansion to be fast.
- groovy2shoes 10y agoI know, I've been a chicken user for some time :) I don't know why, but it slipped my mind while I was writing the above. I think I was just too focused on my goal and wound up screwing it all up anyway. Oh, well, c'est la vie.
- kazinator 10y agoFormally speaking, CL lets anything happen when you rebind standard function names; that's what undefined behavior means. It's a good idea to diagnose that, and not difficult to do. > that doesn't seem to be understood well enough in these discussions is that hygiene is a property of macros, not macro systems Can you cite a comment which doesn't seem to understand this? And it is wrong; of course macros can be hygienic or not; but macro systems which crank out automatically hygienic macros are also themselves called hygienic. Everyone understands what that means. (Or else countless of Lipers, including notable experts, have been wrong for years in how they discuss macros and macro systems.)
- groovy2shoes 10y ago> Can you cite a comment which doesn't seem to understand this? I don't have any on hand, but I've encountered this misunderstanding quite a few times over the years in discussions of macro hygiene. To be clear, I didn't mean to imply that either you or GP don't understand this. It's just something I've noticed before and it seemed like a good time to bring it up. > And it is wrong; of course macros can be hygienic or not; but macro systems which crank out automatically hygienic macros are also themselves called hygienic. Everyone understands what that means. I'm not saying that macro systems can't be hygienic. I'm saying that hygiene is a property of macros. It's not wrong to say that a system like syntax-rules is hygienic, considering that it only allows for the definition of hygienic macros. IMO, the line gets a little blurrier for systems like syntax-case, synclos, or explicit renaming. They're also commonly called hygienic because they provide special facilities for defining hygienic macros, but synclos and ER macros aren't really that different from defmacro+gensym when it comes down to semantics.
- kazinator 10y agoI suspect you're just allowing yourself to be overwhelmed by the ambiguity in "hygienic macro system", which can be parsed as ((hygienic macro) system) or (hygienic (macro system)). The former parse attributes the macros as being hygienic, and the system as having to do with that kind of macro (an not itself being called hygienic). You're welcome.