Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] GC and file descriptors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-19 (13:26)
From: skaller <skaller@o...>
Subject: Re: [Caml-list] GC and file descriptors
On Wed, 2003-11-19 at 07:02, Ville-Pertti Keinonen wrote:
> On Wed, Nov 19, 2003 at 02:19:42AM +1100, skaller wrote:
> > You haven't seen Python 2.2? Its a genuine functional
> > programming language now, with full lexical scoping,
> > closures, and even some advanced concepts like
> > iterators which cannot be programmed in Ocaml.
> AFAIK (correct me if I'm wrong!) Python still doesn't have
> conventional lexical scoping.  

You're wrong :-)

Functions can be nested in Python 2.2, and they're lexically
scoped. You can even do this:

	def f():
		x = 1
		def g(): return x
		return g

and it will work correctly: closures work fine.

What doesn't work the way *I* would expect is that
class scopes are not lexically scoped. I had an
argument with Guido on that -- it would break some
arcane hacks he said.

> Each scope is a dictionary, 

No. Function scopes are basically static,
there's no locals() dictionary. More precisely
there is, but no declared (manifest) local variables
are ever in it.

> > Stackless Python provides the full continuation
> > passing (and Felix provides procedural continuations)
> > so they're both ahead of Ocaml as functional languages
> > on that score :-)
> Stackless Python is a very interesting concept.  One of the things
> I'm interested in generally is how a continuation-based, stackless,
> natively compiled execution model could work out with modern
> programming languages. 

That's Felix:-)

[Well, it uses procedural resumptions, functions
just use the stack though -- i might fix that
if a few people join the project and think it
would be useful: it's not done for efficiency

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: