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
reasons]
http://felix.sf.net
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners