"SFINAE is Evil"

Bill Baxter dnewsgroup at billbaxter.com
Tue Mar 25 14:00:20 PDT 2008


Georg Wrede wrote:
> Jason House wrote:
>> 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?
> 
> I suspect it would be quite simple to add a compiler switch to turn 
> SFINAE on or off?
> 
> Since D2 is "experimental" anyway, we might have this switch for a few 
> months, and then see if anybody actually used it. The default would be 
> SF is an error.

That would be great.  I'd love to try out such a switch.  Though at the 
moment it would do me no good unless it were added to D1 also.  Though 
rather than turning it off, I'd rather have a -v kind of switch that 
prints out a message whenever SFINAE is invoked, maybe with an 
instantiation stack trace.

--bb



More information about the Digitalmars-d mailing list