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

Elmar Stellnberger estellnb at elstel.org
Wed May 27 18:31:42 CEST 2015


Am 27.05.2015 um 18:17 schrieb mika at async.caltech.edu:

> ...
>>> 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.
> 
>     Mika
> 


I would have loved it to make INTEGER = BITS 32 FOR INTEGER and to allow
BITS 64 for INTEGER at the same time. However the way we have already gone is
to make LONGINT an own type with an own suffix like floats (the 'l' suffix). More
strictly typed and not so bad either.



More information about the M3devel mailing list