[M3devel] INTEGER
Rodney M. Bates
rodney_bates at lcwb.coop
Tue Apr 20 17:29:42 CEST 2010
The designers of Modula-3 gave use not one but three floating point types.
They explicitly justified this as matching the range of hardware arithmetic
provided by set of common processors of the day.
They didn't say this (to my knowledge), but one integer type also matched
the hardware of the day. But the period when practically all processors
had the same word size was a historical anomaly. It was a nice halcyon
time in that respect, and it allowed us to avoid some messy problems.
But it never was true prior to that era, and it is no longer true.
I doubt it will be again. Despite the proliferation of 64-bit
machines, there will be useful 32-bit ones around for a years.
Not everybody buys the newest every three years, and 32 bits is
still capable of a lot. I don't see them being retired at anything
like the rate 16-bit machines were, because they don't suffer the
limitations. And then we have the proliferation of embedded and
hand-held devices, which as I am hearing, are already well out ahead
of server and desktop computers in raw processor count.
So I think keeping two integer sizes in the language removes what
many people would consider a serious obstacle. Moreover, the way
the two integer sizes is are now defined is cleaner than I have
seen in any other language. It also somewhat follows the way the
three floating types were done in the original language in that
it preserves the type-uniqueness of every expression. It further
makes the static legality and semantics of code as close to
implementation-independent as it was in the unmodified language.
And it does not change the legality or static semantics of any
old code.
Mika Nystrom wrote:
>
> I actually do like Hendrik's idea of providing some sort of bignum
> support. The reason I don't like LONGINT as much is that it seems it's
> just a waste if we're all going to be using 64-bit machines anyhow.
> It's arbitrary to have two fixed-width types. Why not three or four?
> And why not 128 bits or 16 bits or 36 bits? If on the other hand
> you got something substantial out of it that might be another story.
> In that case, I would say LONGINT would be a reference type (much like
> TEXT) with its associated Longint interface, and infix operators (the
> way TEXT has &) per Jay's fondest dreams. Come to think of it,
> TEXT and such a LONGINT would have a lot in common.
>
> Mika
>
More information about the M3devel
mailing list