[M3devel] mixing INTEGER and LONGINT?

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Sat Jan 9 00:11:54 CET 2010


On Fri, Jan 08, 2010 at 10:30:57PM +0000, Jay K wrote:
> 
>  > The question remains: is LONGINT necessary or simply a kludge 
>  > better satisfied by arbitrary precision arithmetic like 
>  > BigInteger.T?
> 
> 
> Two of us addressed this.
> 
> The answer is not technically/scientifically pleasing.
> The answer is simply that in-fix operators are more convenient and 
> libraries are not.
> 
> Obviously the general clean answer is either:
> 
>    operator overloading on user defined types, making the library convenient 
> 
>    or maybe a language feature for fixed but arbitrary precision integers

Why not make LONGINT the base type for all these fixed but arbitrary 
precision integers.  But don't allow anyone to declare a variable of 
type LONGINT, so we never have to specify a size for it, and its 
subranges can be as large as anyone pleases.

>     e.g. 
      e.g. 
> 
> 
>      int1024 = BITS 1024 for INTEGER
       int1024 = BITS 1024 for LONGINT
 
>      or uint1024 = BITS 1024 for [0..Word.LShift(1, 1024)]
       or uint1024 = BITS 1024 for [0..Word.LShift(1L, 1024)]
> 
>      or uint1024 = [0..Word.LShift(1, 1024)]
       or uint1024 = [0..Word.LShift(1L, 1024)]
> 
> and the compiler would be compelled to generate code for any precision.
> 
> These are both more work.
> 
> LONGINT is indeed a special case.

But if we let it be finite but unbounded it's a rather different special 
case.

-- hendrik



More information about the M3devel mailing list