At Wed, 07 Sep 2011 21:34:41 +0200, Štěpán Němec wrote: > > On Sun, 28 Aug 2011 15:57:19 +0200 > David Maus wrote: > > > At Thu, 25 Aug 2011 12:08:42 +0200, > > Štěpán Němec wrote: > >> > >> On Thu, 25 Aug 2011 06:25:29 +0200 > >> David Maus wrote: > >> > >> > As for the macro: What stop me to implement a macro for the generic > >> > operation is that for now the macro would depend on the global > >> > customization variable. That's not a problem per se but according to > >> > my readings about macros (mostly in context of Common Lisp, but that > >> > shouldn't matter) it should be considered bad style. > >> > >> Could you expand on this a bit? As far as I can tell, you obviously > >> shouldn't depend on a customisation variable at macro expansion time, > >> but I don't see how depending on it at run time is any different from a > >> function doing the same. > >> > > > > At expansion time the macro performs a transformation of the lisp at > > the place where the macro is used. At runtime the code of the expanded > > macro runs in the scope of the function where the macro was expanded > > into. A macro that uses a variable inside the expanded code that is > > not under its control (e.g. part of the argument list or gensym'd) is > > prone to introduce a bug caused by expanding the macro in an > > environment where this variable is not bound or used with a different > > semantics. > > > > In this particular case this should not be a problem indeed because we > > use a global dynamically scoped customization variable. Thus, > > whereever we would use the macro we can be sure the variable in the > > macro expansion is bound and carries the same meaning. > > So your "what stop me to implement a macro" argument is bogus, isn't it? > I can't really comment on whether using a macro or not is the right > thing here, but it seems to me you shouldn't base the decision on an > invalid argument (IOW, from the fact that you even felt the need to > explain why you didn't use a macro to begin with, it would appear to be > the case that you would have preferred the macro way). "One of the things Ford Prefect had always found hardest to understand about humans was their habit of continually stating and repeating the very very obvious, as in /It's a nice day/, or /You're very tall/, or /Oh dear you seem to have fallen down a thirty-foot well, are you all right?/ At first Ford had formed a theory to account for this strange behavior. If human beings don't keep exercising their lips, he thought, their mouths probably seize up. After a few months' consideration and observation he abandoned this theory in favor of a new one. If they don't keep on exercising their lips, he thought, their brains start working. After a while he abandoned this one as well as being obstructively cynical and decided he quite liked human beings after all, but he always remained desperately worried about the terrible number of things they didn't know about." Douglas Adams, The Hitchiker's Guide to the Galaxy -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de