"SFINAE is Evil"

Craig Black craigblack2 at cox.net
Thu Mar 20 19:41:07 PDT 2008


"Jason House" <jason.james.house at gmail.com> wrote in message 
news:frv6ut$2ecv$1 at digitalmars.com...
> SFINAE - Substitution failure is not an error
>
> This post is all about templates and their static if counterparts.  With 
> the
> enhanced expressiveness of D, is there a need for SFINAE from C++?
> Essentially, when a specialization exists, if the compilation of the
> specialization fails, the compiler silently gives up on it and goes to the
> next more general case.  In my mind, this is both dangerous and a loop 
> hole
> for long compile times (as the compiler instantiates extra template
> instances).
>
> What I want to know is this:  Who uses SFINAE in D, and why?  Is this a
> matter of convenience or a requirement.  If required, I assume it's from a
> lack of expressiveness in defining a template's conditions.  Could this be
> overcome with use of static if's instead?
>
> PS: Post title is a quote of Russell Lewis from another thread.

I get the feeling that a number of features in D can eventually be dumped in 
favor of others.  Perhaps SFINAE is one of them.  I haven't used templates 
in D enough to know for sure.  Definitely worth discussing though IMO. 
Anything that reduces the complexity of D without sacrificing expressive 
power is a good thing.

-Craig 




More information about the Digitalmars-d mailing list