Stephen J. Turnbull
stephen at xemacs.org
Tue Apr 26 10:36:16 CEST 2005
>>>>> "Greg" == Greg Ewing <greg.ewing at canterbury.ac.nz> writes:
Greg> This raises the question of why people feel the need for
Greg> macros in Lisp or Scheme, which have an even more minimal
Greg> and flexible syntax. I think part of the reason is that the
Greg> syntax for passing an unevaluated block is too obtrusive.
Greg> [... T]here is a natural tendency to want to be able to cut
Greg> out the lambda cruft....
This doesn't feel right to me. By that argument, people would want
(mapcar (lambda (x) (car x)) list-of-lists)
(mapcar list-of-lists (x) (car x))
Have you ever heard someone complain about that lambda, though?
My feeling is that the reason for macros in Lisps is that people want
control structures to look like control structures, not like function
calls whose actual arguments "just happen" to be anonymous function
objects. In this context, the lambda does not merely bind f, it also
excludes a lot of other possibilities. I mean when I see
I go "What's this? Oh, here the file is obviously important, and
there we have a function of one formal argument with no actual
arguments, so it must be that we're processing the file with the
function." This emphasizes the application of this function to that
file too much for my taste, and I will assume that the behavior of the
block is self-contained---it had better not depend on free variables.
(with-locked-file (f "foo/blarg")
(do-something-with-as-modified-by f x))
there's no particular need for the block to exclusively concentrate on
handling f, and there's nothing disconcerting about the presence of x.
N.B. for non-Lispers: in Common Lisp idiom the list (f "foo/blarg")
may be treated as two arguments, but associating f with "foo/blarg" in
some way. I think in this context it is much more readable.
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
More information about the Python-Dev