Choosing arity of a template function

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 26 17:40:12 PST 2016


On Sat, 27 Feb 2016 01:25:31 +0000, Era Scarecrow wrote:

> On Friday, 26 February 2016 at 23:53:06 UTC, Chris Wright wrote:
>> On Fri, 26 Feb 2016 23:46:11 +0000, cym13 wrote:
>>> On Friday, 26 February 2016 at 23:18:30 UTC, Era Scarecrow wrote:
>>>> On Friday, 26 February 2016 at 23:11:32 UTC, Andrei Alexandrescu
>>>> wrote:
>>>>> Urgh, forgot the "static" in front of the second "if". It does work
>>>>> now.
>>>>
>>>>  Perhaps that should be an error instead; Going from a static
>>>> if to an else if... seems easy enough to spot and insist a fix (much
>>>> like assignment inside an if statement is illegal).
>>> 
>>> What about automatically inferring it? It sounds reasonnable,
>>> much like saying that "static" actually is for the whole if/elseif
>>> block.
>>
>>   static if (oggSupportEnabled)
>>     playOggFile();
>>   else
>>     if (config.loggingEnabled)
>>       info("ogg support not enabled; skipping playback");
>>
>> So, no, unless you want to make curly braces mandatory for conditional
>> bodies.
> 
>   Only for switching between static and non-static code. Besides
> with the static if's, 1 level of bracing doesn't make a new scope
> anyways (if i remember correctly).

This would be a great thing for a lint tool to check, but for a language 
change, it's breaking, and the justification is a bit short.


More information about the Digitalmars-d mailing list