Re: Jim Fulton : Extensible compound statements -- new exec flavor

Guido.van.Rossum@cwi.nl
Thu, 09 Feb 1995 10:55:48 +0100

> Thanks; what do you think about the idea to hide code objects behind some
> kind of function? Since their exposure seemed to be the main objection to
> the user-defined control structure, I'd like to know what problems you're
> seeing with that (or, preferrably, that you'll choose that variant ;-)

[I sent the same reply to Jim Fulton]

Unfortunately, the concept doesn't exist currently in Python. What
exec and compile() does is something completely different (they invoke
the parser each time they are called). Lambda comes closest but (a)
doesn't have access to the current scope, and (b) can only contain
expressions. I'm afraid that introducing this would require reworking
a major part of the interpreter and/or code generator, and I'd rather
leave those alone (especially since Jim Roskind has offered to do some
serious optimizations on them...).

> The question is whether some delay (until the next garbage collection) is
> acceptable. That would mean that resources which depend on __del__ should
> trigger a collection when there's a shortage.

Depends on the application. For Jim's case it's unacceptable.

> > (I remember a message from Bill Janssen announcing a malloc-replacing
> > GC with finalization support -- anyone got time to look into that?)
>
> I'd guess that's a conservative collector. Is that going to work on for a
> non-Unix implementation of Python (I don't care personally, but ... ;-) ?

I *think* I read that they had it working on the Mac and PC as well.

--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>