Python 1.6 The balanced language

Suchandra Thapa ssthapa at harper.uchicago.edu
Wed Aug 30 11:06:29 EDT 2000


Peter Schneider-Kamp <nowonder at nowonder.de> wrote:
>Lazy evaluation? Guido seems to be less reluctant to add this some
>time in the future, if I channel him correctly (what, of course, only
>Tim can do right<wink>). There has always been a lot of people proposing/
>advocating lazy evaluation.

    I don't think lazy evaluation works too well in a language that
isn't purely functional.  You'll never really be sure where when
a variable will be evaluated.  With python's lack of referential
transparency, this will become a nightmare.  E.g.
    def swap(x, y):
	t = y[x - 1]
	y[x - 1] = x
	x = t
	print x','y[x-1]

    x = 3
    y = [3, 2, 1]
    swap(x, y)

prints 3 , 3 which is probably not the programmer intended.  Finding these
kinds of errors would be a nightmare.  ML's use of imperative constructs is
probably one of the reasons why it doesn't employ lazy semantics.

>
>Monads? It took me almost two weeks to understand the concept. Anyone
>seriously proposing to add monads to Python should have to implement
>a Python compiler with Haskell monads first. Note that I had to
>implement a compiler for a Pascal subset using *a lot* of monads.

    I don't think you really need monads in python since they're used
mainly to keep Haskell a pure functional language.  Python's not aspiring
to that goal so monads would just confuse the hell out of everyone.

>
>> >Sometimes there are even technical drawbacks: if you use Stackless
>> >python (corrutines), you can use Jpython compatibility !
>
>It is not impossible to implement coroutines for JPython. It's just
>hard (or impossible) to implement them efficiently without changing
>the VM beneath.

    That comment was by the first poster but I didn't realize that 
continuations were possible on the current JVMs.  Or is the way to get
them on the current VMs just to emulate a machine on top of it?

>>     I don't anyone including Guido wants to have python become an
>> amalgam of Eiffel, Haskell, and Java since their paradigms don't mesh.  I'm
>> not even sure how you would implement a pure functional object oriented
>
>There are stranger things under this sky. E.g. a functional
>language without lambda
>(http://www.eleves.ens.fr:8080/home/madore/programs/unlambda/).

    Actually I think clean is a pure functional oo language.  It's just
that being oo seems to imply that you have some state to your objects.  Not
sure anyone would get around this paradox.  As for unlambda, I don't see 
anyone writing anything significant in it.  I don't think anyone familiar with
functional languages would take a job requiring them to work in it.  But you
never know.



More information about the Python-list mailing list