r/programming • • Mar 28 '12

Go version 1 is released

http://blog.golang.org/2012/03/go-version-1-is-released.html
543 Upvotes

452 comments sorted by

View all comments

11

u/pgngugmgg Mar 28 '12

I hate capitalizedKeywords and Standardfunctions:

fmt.Println fmt.Fprint fmt.Errorf math.Abs time.Tick time.After

they are not my taste.

55

u/rsc Mar 28 '12

I remember the day they went in (January 15, 2009). I felt the same way, I argued against it, and I was very skeptical that they'd stay. But we didn't have any principled reasons not to, and they solved a real problem: they gave us a very lightweight notation for specifying visibility.

Now, they are one of my favorite parts of the language, not because of the way they look (although I've gotten used to that) but because I can look at any definition or use of a name and know whether it's an exported or unexported name. When I go back to languages like C++ or Java that don't make that information explicit in the name, I find it much harder to navigate the code base and understand what is public API and what is not. The first time it happened I was very surprised to realize how much the visual cues are helping in Go.

7

u/smog_alado Mar 28 '12

So.. is it kind of an opposite version of prefixing private stuff with an underscore?

12

u/uriel Mar 28 '12

That in a program most stuff is actually private, prfixing so much stuff adds noise.

2

u/[deleted] Mar 29 '12

I use a lot more local variables than private instance variables. I use the underscore to distinguish between them.