"In praise of Go" discussion on ycombinator

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 16 23:32:21 PST 2010


On Tuesday 16 November 2010 22:55:42 Rainer Deyke wrote:
> 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.  It could be
> correct code written in another style, or it could be code that has been
> mangled during editing and now needs to be fixed.  In Go, I /know/ it's
> mangled code, and I'm far less likely to encounter it, so I can find
> mangled code much more easily.  A compiler error would be even better,
> but Go's syntax is already an improvement over C/C++/D.
> 
> There are huge problems with Go that will probably keep me from ever
> using the language.  This isn't one of them.

Personally, I _hate_ the style of putting the brace on the same line, so I'm 
instantly biased as far as that goes, but the fact that the language does not 
actually require that you put the braces in a particular place and yet you have 
to to make it work properly is definitely a big problem. It's one that can be 
gotten around easily enough with strict formatting guidelines, but C-based 
languages are supposed to be pretty much freely formattable (otherwise why even 
make it optional), so it's a definite faux pas on their part. It's one that they 
should be able to fix without too much trouble, so hopefully it won't really be 
an issue in the long run, but it's definitely troubling. At least with a language 
like Python, it's extremely clear that formatting matters.

- Jonathan M Davis


More information about the Digitalmars-d mailing list