[Python-Dev] A Hygienic Macro System in Python?
David Ascher
DavidA@ActiveState.com
Mon, 18 Mar 2002 17:35:08 -0800
Daniel Mahler:
> Consider a html printer macro library:
>
> html:
> header:
> title:
> print "blah"
> body:
> h1:
> print "bleh"
> p:
> print "foo"
> a (href="http://bar.org"):
> print "bar"
> print "baz"
>
funny. That's not too far from code that I write in Quixote w/ some
extra functions:
template page(request):
header(title("blah"))
body(hl("bleh"),
p(("foo",
a(href="...","bar")),
"baz"
)
note that template is the Quixote part, which removes the need for
unsightly prints =)
My vote on the notion is that I want to know what good macros people
would write, and then implement them in a non-macro fashion. The lock
or connection examples to me indicate a possible language addition which
boils down to something nice and essential (in the meaning of 'of the
essence'). Macros in their generality scare me.
--david