[Python-bugs-list] [ python-Bugs-470429 ] relax data representation spec

noreply@sourceforge.net noreply@sourceforge.net
Thu, 11 Oct 2001 16:31:39 -0700


Bugs item #470429, was opened at 2001-10-11 16:31
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=470429&group_id=5470

Category: None
Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: paul rubin (phr)
Assigned to: Nobody/Anonymous (nobody)
Summary: relax data representation spec

Initial Comment:
I'm not sure how to submit this--"feature request"
isn't really right.  A documentation bug may also be
involved.  The specification for integers is in
section 2.1.4 "Numeric Types" of the Python 2.1.1
library docs, which makes it unclear whether integers
are supposed to be part of the language spec, or
part of the library--so alternative implementations
can implement integers differently and still conform
to the language spec.

Anyway, the Numeric Types section says "Plain integers
(also just called integers) are implemented
using long in C, which gives them at least 32 bits of
precision".  I don't think a sentence like that should
be in a specification, since it describes how something
is implemented (using long in C) rather than how it
should behave.  For example, Jython uses java ints or
longs rather than C longs, so the description that ints
are implemented as C longs is simply incorrect.  So if 
this section is supposed to be a specification, the
reference to C longs should be removed, or clearly
labelled as a description of how one particular
implementation works.

More substantively, I think the requirement that ints
have 32 bits of precision should be relaxed to 30
bits.  That just means changing the specification--
implementations are free to continue supporting 32
bit ints.  But it makes it easier to implement Python
using 32-bit words with tag bits, a traditional
implementation method for dynamically typed languages.
Numerous processors even offer hardware support for
tagged integers--not just special processors like
Lisp machines, but also general purpose RISC cpu's
like the Sparc.  Since Python offers arbitrary sized
longs and already doesn't promise a fixed size for
ints, I don't think it would suffer by offering
implementers a little more flexibility.

In a more philosophical vein, Python is a really cool
language and the designers should begin to think of
"success" in terms of more implementations being
developed, native-code compilers being written, a
possible ANSI standard some day, etc.
So care should be taken to keep the formal
specification as precise as possible, and
free of requirements of things
that are really just implementation hacks.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=470429&group_id=5470