Value range propagation for if-else

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 24 04:18:55 PDT 2014


Shammah Chancellor:

> Wouldn't that cause compiler errors that only happen depending 
> on what order you compile things?

If you refer to the first "solution", then the answer is yes. The 
ability to catch bugs at compile-time is not fully deterministic, 
it's a help for the programmer, but it's not always possible. 
This is why when you use a enum precondition you also have to add 
a regular pre-condition too.

If you refer to the second "solution" then I think the answer is 
no, because your problems doesn't currently happen with templates.

Bye,
bearophile


More information about the Digitalmars-d mailing list