merits of Lisp vs Python

Paul Rubin http
Sun Dec 10 13:07:12 EST 2006


"Alex Mizrahi" <udodenko at users.sourceforge.net> writes:
>  PR> But now you've got an interpreter and you no longer have that Lisp
>  PR> compiler.
> 
> why do you think so?
> if you have C compiler that translates C to assembly, and then compiles 
> assembly to machine language -- that's not C compiler, not asm compiler, or 
> what?
> yes, possibly it would be sub-optimal, but at least it will work. and 
> normally there would be no big performance penalties.

There would be terrible performance penalties dealing with the
environment lookup on every lexical variable reference.  That's the
point.  The compiler would treat those as references to slots in the
call frame, would do type inference so it could use unboxed atoms
where it could, etc.  You'd lose all that.

>  PR> I think he's mistaken about being able to implement call/cc in full
>  PR> generality with CL macros in any reasonable way.
> 
> why do you think so?
> you know some case that does not work with call/cc?

I don't see how to implement coroutines with CL macros.  Maybe I'm
missing something.

> why are you theoretizing -- i've showed working real example of generators!
> just get SBCL and ARNESI, load it,

Too much hassle, I haven't used CL in many years and can't see doing
the big download etc. just to try out one example.  It's not like I'm
going to suddenly discover the delights of CL.  Been there, done that.
I might re-read the LTU papers to see if I'm missing something about
how CPS works.  I've always been hazy on that stuff.

> and then use call/cc as i've shown in 
> example. that's real generators. there's no need for any cond -- you can 
> save state as current-continuation.

Fully general call/cc has to be able to switch from one execution
stack to another and back.  However, that is not needed for Python
generators ("simple generators"), which can only yield to their direct
caller.  I think you might be able to do simple generators with messy
macros but I don't see how you can do call/cc, jumping out to the
continuation across many levels of function calls and then returning
back into all those calls.  The contination is not just a machine
address or environment, it carries a lot of other state.



More information about the Python-list mailing list