On 03/09/13 05:34, H. S. Teoh wrote: > On Fri, Mar 08, 2013 at 07:50:26PM -0800, Walter Bright wrote: >> On 3/8/2013 5:19 PM, Brad Anderson wrote: >>> On Saturday, 9 March 2013 at 00:48:59 UTC, DypthroposTheImposter wrote: >>>> Are they full of it? Has it caused the problems they mention >>>> in >>>> D? >>> >>> Well, the two guys with an alternative proposal (concepts-lite) seem >>> to hate static if (along with a third guy). >>> >>> There seems to be a lot of strawman arguments in this paper. >> >> Many of the criticisms in the paper are addressed by our positive >> experience with static if in D. > > I didn't read the paper, but I have to say that static if in D has been > extremely, extremely useful in my code. Now that I've become acquianted > with it, I can't live without it. It's pretty much a necessity when > writing heavily-templated code. But given C++'s broken template design, > I can see why its value may not have been appreciated by some people. > > D may still have its warts, but in terms of being a "better C++", I > think it has done a superb job, especially in the area of templates and > compile-time mechanisms. Static if + CTFE + sane template syntax = > readable template code = total win for D over C++.
Let me quote a paragraph from that paper: > Being a new and realtively simple-to-use new feature, static_if would un- > doubtedly be used by many who have no need for the relatively small increme- > natal improvement in performance offered. The library writers for which such > techniques really are important, already have to tools and skills needed. No skilled Real Programmer would ever use a language feature that was simple to use. Seriously though, they point out several problems, some of which are C++ context specific (like mixing CPP w/ static-if and lack of introspection). Other mentioned issues are not real problems in practice, or not even problems at all. What's left is: - static-if not creating scopes /is/ confusing, but what would be a better alternative? - (static-)if in templates or as template constraints - a) prevents pre-instantiation verification - true, applies to D, but not really a big problem, assuming sane application of static-if, b) make constraint-based overloading ugly and fragile - true, something better is needed for D too. But until that exists, careful use of constraints mostly works. artur