Robert burner Schadek <rburn...@gmail.com> wrote: > 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 showed you with code examples that you cannot define a user-defined type that is interchangeable with int. So a replacement for a checked int that adds no checks is a UDT with no checks. >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. That is a side discussion as trivial as deciding the defaul second argument for Checked(T, Hook = DefaultHook). This has nothing to do with the design. It is obvious to me that allowing any combination of checks allows naturally for no check. It is also trivial to enforce that at least one check is defined, so again I'd be hard pressed to frame this as a design matter. Andrei