DbI checked integral

Robert burner Schadek via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 26 06:05:26 PDT 2016


On Saturday, 25 June 2016 at 21:32:00 UTC, Andrei Alexandrescu 
wrote:
> So it stands to reason that if you want to design a checked 
> integral types offering a variety of checking policies, one 
> point in the design space that needs to be attainable is "no 
> checks at all". Then the syntactic shell works the same as with 
> any policy, and ideally there's no overhead at all.

There should be away to avoid all checks, true. But I think that 
problem is solved by alias Int = ***** . I think we have to take 
a step back and discuss what this type should actually be used 
for.
IMO it is a debug type and as such should have sensible default 
debug features
like. Default to NaN or throwing Exceptions.

> One good design principle is pushing policy up and 
> implementation down. A NaN is a very specific policy, which is 
> appropriate for a Hook definition but would look out of place 
> in the Checked shell.

See my above argument. If it is a debug type, and that is what I 
think it is,
it should have sensible default hooks.




More information about the Digitalmars-d mailing list