Is there a "Large Scale Python Software Design" ?

Alex Martelli aleaxit at yahoo.com
Tue Oct 19 17:09:41 EDT 2004


Frohnhofer, James <james.frohnhofer at csfb.com> wrote:

> Why do you say 'simple-minded'?

Why do you top-post?

> > 2. simple-minded tools have an easier time offering such editing
> >    services as "auto-completion", which may save a little typing;
> > 
> > 3. simple-minded compilers have an easier time producing halfway
> >    decent code;

Sophisticated compilers can do type inferencing without any need for the
crutch of static typing -- cfr. Scheme's "Stalin", or our own psyco --
for example.  Forcing the user to do the compiler's work allows the
computer to be simple-minded while still making halfway decent code.

A similar case, which surely can't have faded from collective memory
yet, was C's "register" keyword.  Once upon a time, compilers were SO
simple-minded that they couldn't assign registers decently; so, the C
programmer was supposed to help them out by tagging with 'register',
rather than with 'auto' (the default), the variables he wanted to be
kept in registers.  Of course, once the general level of compiler
technology became a bit better, compilers became much better allocators
of registers than programmers could ever hope to be, so they started
treating 'register' as a comment, not helping (nor hindering) them in
doing their job.

Type inferencing is not that much harder than optimal register
allocation, with a decent static typing system (a la Haskell/ML), and is
still well within compiler writers' abilities even with horrid
typesystems or dynamic typing.  (Of course, if the compiler must be
horridly complex no matter what, in order to deal with a horridly
complicated language, the compiler's maintainers are likely to be too
busy fighting alligators to remember their jobs should be to drain the
swamp:-).  If you generally like Python but would like to see it with
static typing and inferencing, try Boo, <http://boo.codehaus.org/>.  For
inferencing (actually type annotation of flow graphs, but that's a
detail;-) on Python w/o static typing, see Pypy,
<http://codespeak.net/pypy/> (not a mature project yet, but very active
and fun to play with;-).


Alex



More information about the Python-list mailing list