UDAs - Restrict to User Defined Types?

Jonathan M Davis jmdavisProg at gmx.com
Thu Nov 8 23:28:57 PST 2012


On Friday, November 09, 2012 08:21:38 Jacob Carlborg wrote:
> On 2012-11-09 07:20, H. S. Teoh wrote:
> > Well, unittests are a runtime check, and they don't *guarantee*
> > anything. (One could, in theory, write a pathological pseudo-range that
> > passes basic unittests but fail to behave like a range in some obscure
> > corner case. Transient ranges would fall under that category, should we
> > decide not to admit them as valid ranges. :-))
> > 
> > But of course that's just splitting hairs.
> 
> But since we do have a language with static typing we can at least do
> our best to try at catch as many errors as possible at compile time. We
> don't want to end up as a dynamic language and testing for types in the
> unit tests.

But the types are already tested by the templat constraints and the fact that 
they compile at all. It's the functions' runtime behaviors that can't be 
tested, and no language can really test that at compile time, whereas unit 
test _do_ test the runtime behavior. So, you get both static and dynamic 
checks.

- Jonathan M Davis


More information about the Digitalmars-d mailing list