[Python-Dev] A Hygienic Macro System in Python? (original) (raw)
Greg Ewing greg@cosc.canterbury.ac.nz
Wed, 20 Mar 2002 12:21:54 +1200 (NZST)
- 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 ]
Paul Prescod <paul@prescod.net>:
Me:
> except that the thunk would have to have write access to > the namespace it's embedded in, perhaps implemented by > sharing the stack frame. If the idea is for it to be a macro feature then yes. But it could be JUST an anonymous implicit thunk. Isn't that how it is in Ruby or Smalltalk?
The idea was to mimic both the syntax and semantics of built-in control structures as closely as possible. If the body were a normal 2.2-style nested scope, the semantics would be different. Most other languages that allow passing of closures don't have this problem, because their closures do have write access to outer scopes.
How would the procedure know what variable names to expect in the block?
Not sure what problem you're seeing here. The body would be compiled as an integral part of the procedure scope it's embedded in, just like the body of any built-in control structure. Names assigned to in the body would become local variables of the procedure.
Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
- 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 ]