[M3devel] cm3 regression

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Wed Apr 16 14:30:14 CEST 2008


On Wed, Apr 16, 2008 at 12:47:58PM +0200, Olaf Wagner wrote:
> Quoting Jay <jayk123 at hotmail.com>:
> 
> >[tangential...]
> >
> >I think the definition of INTEGER is OK, but it'd be nice imho for   
> >the language or m3core to also build-in UINTEGER, INT8, INT16,   
> >INT32, INT64, UINT8, UINT16, UINT32, UINT64, just so folks wouldn't   
> >have to provide them themselves. (CARDINAL I don't think is what I   
> >want.)
> >Add them somewhere in m3core?
> >MODULE Integers; ?
> 
> Such things may be convenient for programmers, but are left out of the
> language because the specification must not become too long, I think.
> I'd opt for library extensions in this case.
> 
> >Unfortunately, actually, I want more than this, and then coming up   
> >with names is hard.
> >
> >I know you can often push stuff out of the language and into a   
> >library. As long as the language allows the library writer to   
> >provide a "nice enough" interface. For example the use of the plus   
> >sign on user defined types.. You know..like C++... but less   
> >complicated and easier to implement and fully understand...
> 
> Ah, operator overloading opens up another of Pandora's boxes,
> I think. It will dramatically increase the complexity of the
> language.
> 
> >In C, "officially", unsigned integers are unsafe and wrap around   
> >silently, and overflow on signed integers is undefined, however in   
> >reality, they are also silent, and I suspect, but am not sure, that   
> >I want both versions..maybe only for compat with existing code.
> >
> >Which reminds me -- am I correct that the Modula-3 language defines   
> >overflow as raising an exception but nobody implements it that way?   
> >I can check. Are folks interested in fixing that?
> 
> Yes, IIRC there are no checks on integer overflow; this is an
> implementation flaw. How would you provide this? Add generation of
> checks on every integer operation?

IIRC, most hardware provides a mechanism for efficient overflow 
detection.  If the language does not provide access to this hardware 
mechanism, if becomes difficult and inefficient for the programmer to 
detect overflow.

Since checked overflow is necessary for many security issues, the 
language needs to make it possible to check.

How it should do so can be a subject for much dispute.

And for Modula 3 it may be difficult if the gcc back end does not 
support it.

-- hendrik



More information about the M3devel mailing list