[M3devel] Integers

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Fri Jan 8 20:04:09 CET 2010


On Fri, Jan 08, 2010 at 11:10:28AM -0600, Rodney M. Bates wrote:
> 
> What's unique about Modula-3 is that such representation changes are
> left to the compiler, while the language merely views values as
> sometimes belonging to more than one type, and allows such values to be
> assigned when so.  The usual approach in other languages is to elevate
> the representation change from a machine-level matter to a language-
> level matter by treating it as an implicit type change in addition to
> a representation change.  The result is always a lot of unnecessary
> complexity in the language.
...
...
> >
> >Where in the language is it important that INTEGER and LONGINT be 
> >different base types?  In other words, what advantages does this 
> >separation convey?
> 
> One thing that is very much needed in a language (not the only thing)
> is a type that always matches the implementation's native arithmetic
> size, which is most efficient.  If you don't distinguish this type,
> it becomes either impossible or horribly convoluted to define arithmetic
> so native machine arithmetic can be usually used where possible,
> but multi-word arithmetic will be used where needed.

Yes.  You do need this type.  And you can even call it INTEGER.  But is 
there any reason it cannot be a predefined subrange type of LONGINT?

-- hendrik



More information about the M3devel mailing list