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

(declare (type fixnum ---)) considered etc.



    Well, I had previously believed that the FIXNUM declaration was
reasonable, but this was based on the erroneous belief that an array
index must be a fixnum.  If it is fact the case that some
implementations have small (2^16) fixnums, then this is a serious
source of non-portability.  A possible solution would be to have an
INDEX type which is (INTEGER 0 (ARRAY-DIMENSION-LIMIT)).

    In any case, I think there are valid arguments for retaining the
FIXNUM declaration:
  1] Much existing code would have to be changed.  This code will probably
     work on any implementation for some range of inputs.
  2] There is precendent for sacrificing portability to gain
     efficiency.

The problem with saying something like (SIGNED-BYTE 32) is that it is
probably just as arbitrary as FIXNUM, yet is unlikely to be a good
match for a given implementation.  In fact in this particular case,
nearly all implementations on conventional hardware would be forced to
consider bignums.

It seems that FIXNUM is no less portable than FLOAT, since nothing is
guaranteed about float exponent range and precision.  A Common Lisp
program which uses floats cannot be totally portable.  One could take
this as an argument against the currently system of float types, but
I don't have a better solution.

I suggest that there should be some short integer type which is
defined to have a reasonably large magnitude (> 2^20).  This is
analogous to the float types which have suggested minimum precisions.
Note that CLTL currently suggest (p 14) that FIXNUM be at least
(SIGNED-BYTE 16), so uses of FIXNUM consistent with this can be
considered portable.

  Rob