First release of Shed Skin, a Python-to-C++ compiler.

Michael Sparks ms at cerenity.org
Sun Sep 11 17:20:06 EDT 2005


Paul Boddie wrote:

> Michael Sparks wrote:
>> Well, you did say you want help with locating problems. One problem with
>> this is it doesn't build...
> 
> I found that I needed both the libgc and libgc-dev packages for my
> Kubuntu distribution - installing them fixed the include issues that
> you observed - and it does appear to be the Boehm-Demers-Weiser GC
> library, yes. The only other issue I observed was the importing of the
> profile and pstats modules which don't exist on my system, but those
> imports seemed to be redundant and could be commented out anyway.

Mark's also let me know this. Part of the problem is the version in SuSE 9.3
of the GC used is ancient - it should be version 6.5 onwards. Also for
people compiling from source you (at minimum) should be using the
configure line along the lines of:

     ./configure  --enable-cplusplus

If you don't, you get build problems because one of the needed libraries
isn't built by default. 

I started off with the obvious "hello world" type program :

----------------------------------------
print "GAME OVER"
----------------------------------------

Which compiled cleanly and worked as expected. I then read Mark's short
paper linked from his blog "Efficient Implementation of Modern Imperative
Languages; Application to Python", and got concerned by the comments:

"""We have decided not to investigate two types of features: [...snip...];
and those features that may be turned off without affecting correct
programs, e.g. array bounds checking, and exceptions"""

That set some alarm bells ringing, largely because LBYL being deprecated by
many people in favour of exceptions based code. (And more to the point,
widely used as a result)

As a result, I tried a trivial, but obvious program that should have clear
behaviour:

----------------------------------------
x = []
print "GAME OVER"

x.append(5)
print x[0]
try:
   print x[1]
   print "This should never be seen..."
except IndexError:
   print "It's OK, we caught it..."
----------------------------------------

This compiles, but unfortunately has the following behaviour:

GAME OVER
5
0
This should never be seen...
It's OK, we caught it...

Obviously, neither the 0 nor the message following should have been
displayed. It's a pity that this assumption was made, but given the short
time the project's been going I can understand it, hopefully Mark will
continue towards greater python compliance :)



Michael.




More information about the Python-list mailing list