A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/021466.html below:

[Python-Dev] A Hygienic Macro System in Python?

[Python-Dev] A Hygienic Macro System in Python?Greg Ewing greg@cosc.canterbury.ac.nz
Wed, 20 Mar 2002 12:21:54 +1200 (NZST)
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	   +--------------------------------------+



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4