C++ guys hate static_if?

monarch_dodra monarchdodra at gmail.com
Thu Mar 14 08:05:51 PDT 2013


On Thursday, 14 March 2013 at 11:04:59 UTC, Artur Skawina wrote:
> On 03/14/13 10:26, Don wrote:
>> On Saturday, 9 March 2013 at 03:50:29 UTC, 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 think the hard-to-analyze argument is a good one.
>> 
>> I've created an enhancement for some analysis we could do 
>> without too much work:
>> http://d.puremagic.com/issues/show_bug.cgi?id=9715
>> (I think my bug report shows a bigger problem with static if, 
>> than is reported in the paper; the problems arise only when 
>> you have two static ifs in the same scope).
>> 
>
> The gain from such checks would be minimal. Eg "return 
> x.toray;".
>
> artur

I've already found plenty of such bugs in phobos, and wouldn't be 
surprised if this was one of its bigger sources of bugs.

Sure, phobos is template and static "super heavy", given it is 
more or less the D-STL, but still.

If the compiler can statically determine that a template branch 
simply *can't* compile, then the code should be turned down.

Having to instantiate a template just to check to make sure it is 
semantically correct is a huge pain.


More information about the Digitalmars-d mailing list