opImplicitCast/opImplicitCastFrom

KennyTM~ kennytm at gmail.com
Mon Oct 27 08:19:52 PDT 2008


bearophile wrote:
> KennyTM~:
>> The Bounded!() (originally Positive!()) template suggested by Andrei 
>> earlier?
> 
> No, I mean something built-in, and generally invisible. See ObjectPascals.
> 

I haven't touched Pascal after Turbo Pascal 7 for DOS, so I thought 
you're talking about the subrange types in Pascal. I mean something like 
this:

   var
     x: 1..10;
     y: 'A'..'Z';

Do you mean automatic integer overflow checking (i.e. bounds checking)?

> 
>> When a programmer cares for integer overflow one can use Bounded!(T.min, T.max).
> 
> Nope. It has to be the other way round: when a programmer doesn't care of avoiding some integer-related bugs he/she/shi can add a "-release" to the compilation arguments. Forcing the programmer to use an ugly and long syntax everywhere in the program isn't a way to avoid that class of bugs in most D programs.
> 

I see. This is much more elegant.

> Bye,
> bearophile



More information about the Digitalmars-d mailing list