in reply to Re^2: Overcoming addiction to Lisp in thread Overcoming addiction to Lisp
None of these, to me, a new Lisper, are what macros are about. Macros are about being amazingly lazy as a programmer. About finding those patterns of code that you write all the time, and making the system do the work for you in ways that are nearly impossible in other languages.
It's not about speed, though certainly macros can be faster, especially if you look at things like the CL regex engine. The point is that I'm lazy, and I don't like typing things, and macros let me say it once, and more succinctly than other things.
Lisp isn't the hammer for every problem, nor is Perl, nor is any tool. I don't trust a programmer who things his favorite hammer is the best hammer.
Re^4: Overcoming addiction to Lisp
by Anonymous Monk on Jun 16, 2005 at 03:15 UTC
|
As an experienced Lisper (and mostly Schemer today) I have used both hygienic as well as non-hygienic (Common Lisp) macros. I'm going to be something of a heretic here, but in nearly every case there is likely something *better* to use than a macro. As an implementor of Scheme i've seen a number of additions that supplement R5RS (or even Common Lisp) that remove just about every need for a macro. A simple builtin function such as LAMBDA-CASE removes the need for just about every Scheme macro in existance. And here is the real kicker... the closer you get to a programmable programming language (what Lisp is known for anyhow), the more odd and almost alien macros become. They almost blend into and become functions themselves, in a way.
If this sounds confusing, imagine a Lisp interpreter (or Lisp Machine) that is always running (and evolving.. just like the good old days). Macros *must* become first-class citizens, or they simply don't make sense at all. And, of course, many people have already proposed such additions! In this manner, they aren't much different from functions which are first-class already. And there have even been "lexical macros" which retain source-level information for debugging purposes. Hmm.. I wonder what else can be tied to lexical scope and is first-class.... functions! | [reply] |
|
Do you mean case-lambda, or are you refering to something different?
| [reply] |
Re^4: Overcoming addiction to Lisp
by Anonymous Monk on Jun 16, 2005 at 11:21 UTC
|
Eliminating reduntant code has more advantages than just laziness. It improves code quality, especially during maitenance. | [reply] |
|
Exactly. That's what subroutines and modules are for.
| [reply] |
|