[Issue 1951] New: Remove SFINAE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 26 15:41:35 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1951

           Summary: Remove SFINAE
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: jason.james.house at gmail.com


I can imagine the request sounding almost crazy, but it really isn't.
(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)

I've been polling people on the D mailing list and those I know who are deep
into C++, and so far nobody can come up with a real-world use for SFINAE that
can't be done with other mechanisms already in D (is expressions, static if,
etc...)

What I have been able to find out from people is that SFINAE does cause
debugging nightmares with template based code when a specialization fails to
compile as expected.

I think trying no SFINAE is a great thing to try in 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.

If it does turn out that SFINAE does provide unique functionality (I expect
Andrei may know), I think it may be better to enhance existing generic
programming techniques than to keep SFINAE.  The further SFINAE gets pushed out
of normal use, the more of a corner case it becomes...  biting developers more
often than it helps them.


-- 



More information about the Digitalmars-d-bugs mailing list