Re: Python, Parrot, and lexical scopes

2004-10-21 Thread Dan Sugalski
At 12:51 PM -0500 10/20/04, Allen Short wrote: On Tue, Oct 19, 2004 at 11:23:13AM +0200, Leopold Toetsch wrote: * the import statement is simulated too by storing the lexicals into the caller's frame. This would very likely be another Python opcode. I should point out that this is much more li

Re: Python, Parrot, and lexical scopes

2004-10-21 Thread Allen Short
On Tue, Oct 19, 2004 at 11:23:13AM +0200, Leopold Toetsch wrote: > * the import statement is simulated too by storing the lexicals into the > caller's frame. This would very likely be another Python opcode. I should point out that this is much more like Python's semantics for "import *" than Da

Re: Python, Parrot, and lexical scopes

2004-10-19 Thread Leopold Toetsch
Sam Ruby <[EMAIL PROTECTED]> wrote: > ... Suggestions welcome, in > particular, a PIR equivalent to the Perl would be most helpful. It could be something like below. Some remarks: * we don't have a notion to create a Closure PMC, so these closures are handcrafted. (NB: a subroutine with a .yi

Re: Python, Parrot, and lexical scopes

2004-10-18 Thread Sam Ruby
Sam Ruby wrote: Consider the following code: def f(x): return len(x) for i in [0,1]: print f("foo") f = lambda x: x.upper() No, don't. Consider the following code instead: def f(x): return len(x) for i in [0,1]: print f("foo") len = lambda x: x.upper() Key differenc

Re: Python, Parrot, and lexical scopes

2004-10-18 Thread Sam Ruby
Dan Sugalski wrote: At 7:55 AM -0400 10/18/04, Sam Ruby wrote: I've been trying to make sense of Python's scoping in the context of Parrot, and posted a few thoughts on my weblog: http://www.intertwingly.net/blog/2004/10/18/Python-Parrot-and-Lexical-Scopes While I posted it on my

Re: Python, Parrot, and lexical scopes

2004-10-18 Thread Dan Sugalski
At 7:55 AM -0400 10/18/04, Sam Ruby wrote: I've been trying to make sense of Python's scoping in the context of Parrot, and posted a few thoughts on my weblog: http://www.intertwingly.net/blog/2004/10/18/Python-Parrot-and-Lexical-Scopes While I posted it on my weblog for formatting a

Re: Python, Parrot, and lexical scopes

2004-10-18 Thread Sam Ruby
Sam Ruby wrote: It seems like everything on that page boils down to: all functions are module-scoped closures. A closer translation: "How do I implement module-scoped closures in Parrot?" OK, I've roughed out an implementation: http://intertwingly.net/stories/2004/10/18/scopes.pir http://intertwin

Re: Python, Parrot, and lexical scopes

2004-10-18 Thread Sam Ruby
Sam Ruby wrote: Unfortunately, these PMCs don't seem to have test cases. Correction: t/pmc/sub.t - Sam Ruby

Re: Python, Parrot, and lexical scopes

2004-10-18 Thread Sam Ruby
Aaron Sherman wrote: On Mon, 2004-10-18 at 07:55, Sam Ruby wrote: I've been trying to make sense of Python's scoping in the context of Parrot, and posted a few thoughts on my weblog: http://www.intertwingly.net/blog/2004/10/18/Python-Parrot-and-Lexical-Scopes It seems like everything on

Re: Python, Parrot, and lexical scopes

2004-10-18 Thread Aaron Sherman
On Mon, 2004-10-18 at 07:55, Sam Ruby wrote: > I've been trying to make sense of Python's scoping in the context of > Parrot, and posted a few thoughts on my weblog: > > http://www.intertwingly.net/blog/2004/10/18/Python-Parrot-and-Lexical-Scopes It seems like everything o

Python, Parrot, and lexical scopes

2004-10-18 Thread Sam Ruby
I've been trying to make sense of Python's scoping in the context of Parrot, and posted a few thoughts on my weblog: http://www.intertwingly.net/blog/2004/10/18/Python-Parrot-and-Lexical-Scopes While I posted it on my weblog for formatting and linking reasons, feel free to resp