for loop parens

Simen Kjaeraas simen.kjaras at gmail.com
Fri Jul 12 13:49:40 PDT 2013


On 2013-07-12, 22:38, ixid wrote:

> On Friday, 12 July 2013 at 20:30:59 UTC, bearophile wrote:
>> ixid:
>>
>>> Similarly what are D user's potential issues with Go-like semi-colon  
>>> rules? And would this be possible as a subset of current D code?
>>
>> Such changes will not happen even in D4. Walter is strongly against the  
>> idea of optional semicolons, on the base that semicolons help the  
>> parser, so they allow better error recovery and error messages.
>>
>> Bye,
>> bearophile
>
> Is there any evidence that these are issues in Go?

I'm not sure how much of a problem it is, especially given that Go has a
strict style guide, but the objection has come up that these two are
very different:

   if i < f() {
       g()
   }

and

   if i < f()
   {
       g()
   }

In the second case, a semicolon is inserted on the same line as the if.

However, like I said, in idiomatic Go, this is simply not a done thing.

-- 
Simen


More information about the Digitalmars-d-learn mailing list