[M3devel] longint..revisited?

Tony Hosking hosking at cs.purdue.edu
Fri Jan 8 17:08:20 CET 2010


Again, this proposal raises serious problems regarding implicit coercions, against the design principals of the Modula-3 type system.

On 7 Jan 2010, at 22:35, Jay K wrote:

> I can't find Rodney's proposal but I think I understand
> a lot of it from today's mail.
> 
> 
> Can we revisit this?
> 
> 
> My understanding is that Rodney's proposal
> deems INTEGER assignable to LONGINT,
> and vice versa, and that assignments of LONGINT
> to INTEGER undergo runtime range checks,
> can raise exceptions.
> 
> 
> I assume it also follows that:
> 
> 
> LONGINT can be added/subtracted/modded to INTEGER,
> yielding LONGINT.
> 
> 
> INTEGER MOD LONGINT would range check the LONGINT.
> 
> 
> INC/DEC(LONGINT, INTEGER) would just work
> 
> 
> INC/DEC(INTEGER, LONGINT) would range check.
> 
> 
> The downside is that the chance for failure would be
> silently injected into various places.
> 
> 
> Another proposal would be that INTEGER is assignable to LONGINT,
> but not vice versa. I really don't see why not.
> 
> 
>    LONGINT := INTEGER  
>    LONGINT + INTEGER => LONGINT  
>    LONGINT - INTEGER => LONGINT  
>    LONGINT * INTEGER => LONGINT  
>    LONGINT / INTEGER => LONGINT  
>    LONGINT MOD INTEGER => INTEGER (think about it) 
>    INC(LONGINT, INTEGER)
>    DEC(LONGINT, INTEGER)
> 
> 
> all seem very reasonable.
> 
> 
>  - Jay
> 




More information about the M3devel mailing list