What's better about Ruby than Python?

Andrew Dalke adalke at mindspring.com
Wed Aug 20 01:30:15 CEST 2003

Alexander Schmolck:
> One thing that makes such an attempt fairly unattractive for anyone with
> finite amounts of time is that python isn't that much use without its
> supporting C/C++ modules schemes/lisps suck in the FFI department (every
> lisp/scheme has its own way of interfacing to C).

If Parrot gets enough Python working for the challenge, then someone
could write a Lisp-y language targeting Parrot, and take advantage
of the work of others.

For that matter, there's Lisps on the JVM, no?  Could support

> Could you say a little bit more about it? In python I think one could to
> extent use operator overloading and a special expression class, that
> simplifies the literal expression the programmer stated, but I guess then
> would then to explicitly request evaluation (and operator overloading
> quite powerful enough to easily incorporate 'alien' class-instances, too).
> Is the C++ code something along those lines, or different?

Different.  The problem with the operator overloading approach is
the creation and description of intermediate objects.  If you do

a = b + c * d

then  "c*d" makes an intermediary temporary.

Template expressions solve it by providing a description of
how to do the add, early enough that the compiler can optimize
based on the whole express.  Eg, for vectors, the compiler
could generate code equivalent to

  for (i=0; i<n; i++) {
    a[i] = b[i] + c*d[i];

Here's an old reference

                    dalke at dalkescientific.com

More information about the Python-list mailing list