Feature request: extending comma operator's functionality

Timon Gehr timon.gehr at gmx.ch
Fri Oct 5 00:16:40 PDT 2012


On 10/04/2012 11:56 PM, Tommi wrote:
> On Thursday, 4 October 2012 at 21:32:34 UTC, Jonathan M Davis wrote:
>>
>> If you want to restrict the scope of a variable, you can simply use
>> another set of braces to create a new scope. It might be more verbose
>> than desirable, but it works just fine. e.g.
>>
>> {
>>  int n = getInt();
>>  if(n > 10)
>>  {
>>  ...
>>  }
>> }
>
> But if there are else-if clauses, then you end up polluting your
> namespace, and notice how the syntax of your workaround deteriorates
> exponentially:
> ...

Check your math.



More information about the Digitalmars-d mailing list