[Python-Dev] A Hygienic Macro System in Python? (original) (raw)
Neil Schemenauer nas@python.ca
Mon, 18 Mar 2002 13:37:37 -0800
- Previous message: [Python-Dev] A Hygienic Macro System in Python?
- Next message: [Python-Dev] A Hygienic Macro System in Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jeremy Hylton wrote:
There has not been much interest in macros of any sort, although there have been a few threads on comp.lang.python recently. It may be that a few motivating examples would make clear why we should be interested :-).
I'm interested. It's hard though in a language with a lot of syntax, maybe no even worth doing. Dylan macros are a lot less powerful than Common Lisp macros.
Two applications immediately come to mind. First, Quixote's unit test module (now known Sancho). Right now you have to write:
self.test_val("foo.dosomething()", 2)
It would be nice if you could instead write:
test_val(foo.dosomething(), 2)
Secondly, Quixote's PTL compiler. If Python had macros I wouldn't have written it. Take a look at the HTML Generation facility that comes with Allegroserve�.
I think I understand why macros work so well with Common Lisp. In Common Lisp, the AST is really a list. The AST is easy to read and write and it's easy to make macros transform it. That gives Common Lisp programmer's an amazing amount of power. Maybe Guido thinks it gives them too much. Myself, I don't know. Most of the time you don't need macros but when you do you really do.
Neil
�http://allegroserve.sourceforge.net/htmlgen.html
- Previous message: [Python-Dev] A Hygienic Macro System in Python?
- Next message: [Python-Dev] A Hygienic Macro System in Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]