SFINAE

Christopher Wright dhasenan at gmail.com
Wed Oct 8 16:30:41 PDT 2008


Jason House wrote:
> Now that we're all talking about templates and Andrei is participating on
> this list, I figure it's a good time to bring this topic up again.
> 
> (brief background: SFINAE = substitution failure is not an error.  Commonly
> used when selecting which templated definition to apply.  Most uses in C++
> are tricks to determine info available in D is expressions)
> 
> SFINAE causes debugging nightmares with template based code when a
> specialization fails to compile as expected.  When I challenged people in
> the past to provide real examples of template code that would require
> SFINAE in D, nobody could come up with one.  The template declaration and
> constraints in D seem to be enough.
> 
> I think we should try removing SFINAE from D 2.x while it's still considered
> experimental/alpha.  I expect a lack of SFINAE to make the compiler simpler
> and ensure D preserves its fast compile times.

SFINAE means backtracking. You can substitute it with templates that 
manually select the appropriate other template to instantiate, which is 
hella easier to work with. While this doesn't solve naming collisions, 
we have other methods for doing that already.



More information about the Digitalmars-d mailing list