"SFINAE is Evil"

Jason House jason.james.house at gmail.com
Mon Mar 24 18:59:52 PDT 2008


Bill Baxter wrote:
> Jason House wrote:
>> I look forward to when you can write more... Are you trying to say SFINAE
>> is needed?
> 
> Yes, I'm saying I haven't yet found a case where I'm using it (but that
> doesn't mean there isn't one!)
> 
> However, I did start a thread a while back about a way to introduce
> /controlled/ SFINAE.  Or rather a way to explicitly say you want to try
> something, and if it does generate an error, try something else.
> Compile time try-catch.  Look for the subject "static try catch
> construct would be helpful" in this newsgroup.  I still think that would
> be useful.

I also had the feeling of "SFINAE is needed, but I can't come up with any
examples".  I find it interesting that nobody posted a need for SFINAE. 
Because of that, and all the pitfalls, I agree that SFINAE as a default
behavior is undesirable and should disapear from D.

Rather than propose an alternative to it, I wanted to understand how it
should be used in D.  With no examples of it, I've started leaning toward
simple removal of it.  I started this thread thinking the likely outcome
would be something like your proposal.  Now I'm thinking that SFINAE is not
needed.  If that's not true, I'm thinking it may be better to enhance is
clauses and/or CTFE to cover the (small) capability gap.

What do you think of that?  If you (and others paying attention to this
thread) agree, how do we get the attention of Walter?  Maybe it should be a
feature request or an entry on the unofficial D wishlist?



More information about the Digitalmars-d mailing list