If you want X, you know where to find it (was Re: do...until wisdom needed...)

Douglas Alan nessus at mit.edu
Thu Apr 19 02:31:57 EDT 2001


Courageous <jkraska1 at san.rr.com> writes:

> >   @let x = 3

> >where "@" means that a macro invocation is coming up.

> Hrm. Don't think so. Any hypothetical Python-native macro utility
> should be very tightly integrated such that it allows you to create
> your own special-purpose dialect of the language on a per-project
> basis if need be. One of the appeals of utilities like this is to
> map domain-specific capabilities directly onto a computer
> programming language. Tis one of the lasting contributions of Lisp
> to the programming community, it is.

I'm not sure I see how having macro invocations stand out *slightly*
violates any of this.  I've never quite liked the fact that in Lisp
you may have trouble telling a procedure call from a macro invocation,
considering that the semantics can be quite different.  It's nice for
macros that make their way into every day use, like "loop", since
you'll recognize the name instantly.  But it's not quite as nice when
the macro is a bit more obscure.  On the other hand, if "loop" had
been called "@loop", instead, I wouldn't have lost any sleep over the
inconvenience of having to type that "@".

Perhaps in Python you could get away without having any special macro
invoking syntax, but since I know nothing about how the Python parser
is implemented, I have no idea how easy or hard that might be.  I
suspect you *could* get away without any special macro invoking syntax
due to the way that Python is rather line-oriented.  I.e., if a line
is not a continuation line, and the second token on the line isn't
".", "=", "(", "+=", "+", etc., and the first token isn't a keyword,
then look the first token up in the macro table.  I wouldn't bet my
life on this being workable without doing more research though.

|>oug



More information about the Python-list mailing list