Why opDispatch uses SFINAE implicitly?
Dukc via Digitalmars-d
digitalmars-d at puremagic.com
Wed Mar 1 22:40:29 PST 2017
If I define an opDispatch for something, but the call does not
compile, the compiler currently behaves as if the opDispatch
didn't exist at all. Just like C++ templates as far as I know.
Why is this? I think it would be better if it acted like other D
templates: Compilation failure is always an error, but you can
use preconditions if you want the "substitution failure is not an
error"-idiom. This would be better to detect errors.
Is there any way to define a dispatching type so that it errs or
at least announces if the call does not compile?
More information about the Digitalmars-d
mailing list