[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

issue BOGUS-FIXNUMS (initial draft)



Issue:		BOGUS-FIXNUMS
References:	CLtL p. 14, 34, 43, 231
Category:	CHANGE
Edit History:   Version 1, 11 Jul 1988 (Sandra Loosemore)


Problem Description: 

Implementations of Common Lisp are required to support two disjoint
subsets of integers, fixnums and bignums.  While in many
implementations these correspond to different internal
representations, some implementations may support only a single
representation for all integers.  In such a case, arbitrarily
designating some subrange of integers as "fixnums" becomes an
artificial contrivance which is more likely to confuse users than to
ensure portability of code.


Proposal: BOGUS-FIXNUMS:ELIMINATE-DISTINCTION

(1) Remove all references to the partitioning of the type INTEGER into
FIXNUM and BIGNUM.  Remove FIXNUM and BIGNUM from the table of standard
type specifier symbols on page 43 of CLtL.

(2) Remove the constants MOST-POSITIVE-FIXNUM and MOST-NEGATIVE-FIXNUM
 from the language.  

(3) Introduce a new constant, MAX-INTEGER-LENGTH.  This is the maximum
number of bits appearing in any integer; therefore, it is an upper
bound on the INTEGER-LENGTH function.  The value can be NIL if there
are no limits short of memory availability.


Rationale:

Since CLtL does not guarantee anything about the range of fixnums
(saying only that they will *typically* be between -2**n and 2**n - 1,
for n not less than 15), any user program that uses FIXNUM or BIGNUM
declarations is already nonportable.  Using these type specifiers for
discrimination is also of questionable utility in portable code.  In
removing these type specifiers from the language standard, this proposal has
no effect on portability.


Current Practice:

KCL has only a single representation for integers, as do a number of
Common Lisp subsets (including XLisp and A-Lisp).  Some Lisps have
more than two representations for integers; PSL, for example, has
three different representations, similar to Lisp 1.6.  Franz Lisp and
Interlisp also have three different integer representations.

Implementations do not necessarily limit bignum size only by the amount of
"available memory" (which is a rather vague concept anyway).  For example,
many implementations restrict the length of the bignum to be representable
in a fixed-length field.


Cost to implementors:

Slight.  Implementations that support different representations for fixnums
and bignums can continue to do so and provide the type specifiers as a
compatible extension.


Cost to users:

Slight, at least in portable code.  If implementors continue to
support the FIXNUM and BIGNUM type specifiers, existing (nonportable)
user code that relies on them would continue to work in those
implementations.  It's possible that some portable user programs
actually use the value of MOST-POSITIVE-FIXNUM or MOST-NEGATIVE-FIXNUM
(for example, to scale fixed-point values to fit in a fixnum).


Benefits:

Removing the distinction between fixnums and bignums simplifies the
language.  It reduces ambiguity in the case where there are more than
two integer representations. 

Introducing a new constant to describe the maximum size of integers makes
it possible to describe an implementation's exact limitations on the range
of integers it supports.  This constant would also be useful for the
description of subset implementations.


Discussion:

Addition of the MAX-INTEGER-LENGTH constant was suggested by Stan Shebs,
who supports this proposal.-------