[M3devel] 64bit INTEGERs, WIDECHAR: language specified or configuration/target dependent?

Rodney M. Bates rodney_bates at lcwb.coop
Thu May 28 02:41:35 CEST 2015



On 05/27/2015 11:17 AM, mika at async.caltech.edu wrote:
> ...
>>> Whether types like integer have a language-specified or =
>> target-dependent
>>> range is a tough language design question.  I have tended to favor a
>>> fixed, language-specified range, but there are pros and cons.  I do
>>> think all the time about end-of-range cases and native word size =
>> dependencies.
>>> It takes a great deal of care, and I know of no way to design a =
>> language
>>> that doesn't, to some extent, trade one set of problems for another.
>>> Signed/unsigned creates similar language dilemmas.
>>
>> * language-specified or target-dependent
>> As I have already suggested I believe there is some justification to =
>> have
>> both kinds of type: a language dependent type and a target dependent one
>>
>> The advantages of a language dependent type are rather clear when it
>> comes to mere INTEGERs for numeric/counting/calculation purposes. Once
>> you have a fixed size you can rely on support of a certain value range.=20=
>
> Hmm?
>
> Modula-3's INTEGERs are the "integers" of mathematics.  The intent is
> that if your implementation is limited and doesn't support a particular
> operation because it goes out of range, your computation aborts.  Same
> as any other implementation limitation.
>
> There is no reason I can think of you couldn't come up with an implementation
> that has unlimited-range integers.  FIRST(INTEGER) and LAST(INTEGER) would have
> to be a little special.
>

We've got it in library code:

   cm3/m3-libs/arithmetic/src/basictypes/biginteger/BigInteger.i3

Does it need to be improved?  I've never used it.

But it can't just replace a fixed-sized integer type like INTEGER in a language,
because we really need INTEGER for subscripts to the array of INTEGERs that
implements BigInteger, and lots of other stuff.  For a precedent, mathematicians
have never, AFAIK, proposed to generalize the infinite series' used to compute
powers and roots by replacing the integer subscripts of the series with
rationals, reals, or complexes.  What is the Pi'th term in an infinite series?

>       Mika
>

-- 
Rodney Bates
rodney.m.bates at acm.org



More information about the M3devel mailing list