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

Re: small integers

One idea I had for dealing with fixnums overflowing and either turning into
bignums, or signaling and exception was to use the concept of retry handlers;
there could be a pair of retry handlers, one of which would convert the 
result to a bignum and return, the other of which would just re-raise the
condition. The programmer could select which handler he wanted active; the
protocol in force should be determinable statically in most cases.

Another possibility is to add a new pseudo-numeric type called 'long'; this
would be an abstract modelling of a fixed length sequence of binary variables
whose length is precisely equal to the number of bits in the physical
machine's long word. Various operations, such as treating these objects 
as representing binary numbers and performing logical operations, such as
addition modulo 2^k-1 could also be defined, and to save keystrokes, bound
to some single character generic function such as, to pick one out of the hat,
+, in much the same way as + is often used to indicate sequence concatenation.

Of course, such a type would need quite a lot of boxing analysis, but since
we're going to have to do that for floats anyway, we might as well get some
mileage out of our code!