"In praise of Go" discussion on ycombinator

Daniel Gibson metalcaedes at gmail.com
Wed Nov 17 03:11:16 PST 2010


Daniel Gibson schrieb:
> Rainer Deyke schrieb:
>> On 11/16/2010 22:24, Andrei Alexandrescu wrote:
>>> I'm curious what the response to my example will be. So far I got one
>>> that doesn't even address it.
>>
>> I really don't see the problem with requiring that '{' goes on the same
>> line as 'if'.  It's something you learn once and never forget because it
>> is reinforced through constant exposure.  After a day or two, '{' on a
>> separate line will just feel wrong and raise an immediate alarm in your
>> mind.
>>
>> I would even argue that Go's syntax actually makes code /easier/ to read
>> and write.  Let's say I see something like this in C/C++/D:
>>
>> if(blah())
>> {
>>   x++;
>> }
>>
>> This is not my usual style, so I have to stop and think.  
> 
> What about
> if( (blah() || foo()) && (x > 42)
>     && (baz.iDontKnowHowtoNameThisMethod() !is null)
>     && someOtherThing.color = COLORS.Octarine )
> {
>   x++;
> }

"someOtherThing.color = COLORS.Octarine" was supposed to be
"someOtherThing.color == COLORS.Octarine" of course.


More information about the Digitalmars-d mailing list