News for hackers. Stuff that matters.
Re:The State of Go by seagreen on Sunday February 05, 2017 @01:54PM (#13573855)

  Maybe it's because I don't have the "depth"
  of some of the HN users, but Go feels great to me.
I doubt I have any more depth than you as a programmer, but I've gone one step farther than you down the language safety progression, so maybe my thoughts from here will be interesting.

When I moved from Python to Go not only did my code become more safe, I actually became a better programmer. There are a lot of silly things that you can do in Python that you can justify saying "just this once!" or "it's only temporary!" that are much harder to do with Go. I started writing a lot less complicated functions that did different things with different types, and moved to writing simpler, single purpose functions whenever possible. This was great and I learned a lot.

Then I moved from Go to Haskell, and the same thing happened again.

Haskell makes you specify whether a type can be null or not. It has referential transparency, so you can't mutate variables as a side effect of a function. It has sum types, eg:

  data User = Unauthenticated | Normal UserId | Admin UserId
.. that make it really easy to enforce invariants and are also super convenient to use because of pattern matching. I write a lot less "stringly typed" code now than I did when using Python or Go.

Now there are downsides -- Go has a great standard library, and it's tooling is fantastic (even down to little things like gofmt). I'm not saying you'd have a better experience with Haskell, just that there are real reasons why someone wouldn't want to go back after trying a more featureful language than Go.

Re:The State of Go by hota_mazi on Sunday February 05, 2017 @02:14PM (#13573980)
> When I moved from Python to Go not only did my code become more safe, I actually became a better programmer.

This is probably more due to the fact that you moved from a dynamically typed language to a statically typed one rather than this new language itself.

Re:The State of Go by dvirsky on Sunday February 05, 2017 @02:27PM (#13574061)
But Go really does encourage good practices. I came to Go after programming in C, C++, Java and a bunch of dynamically typed languages. After a couple of years with Go I returned to C (and a bit to Java). And I'm writing better code in those languages now.

Now, part of it is natural progress probably. But especially when I'm writing C, I can tell that I'm writing it much better than before because I'm adopting back some idioms that Go encouraged me to adopt in the first place.

Also, because Go's standard library is so well written, you can learn from the best very easily, and understand what's going on. It's certainly not the case with other languages I write in.

Re:The State of Go by Retric on Sunday February 05, 2017 @03:43PM (#13574523)
I suspect every time you move to a different language family you learn new things. I did C/C++ and Java then worked with an old Pascal codebase of all things that IMO taught me more than most other languages. Even XSLT taught me quite a bit.
Re:The State of Go by dvirsky on Sunday February 05, 2017 @04:52PM (#13574857)
I can't say that Java has improved me in any language, but Go and Python have improved my Java. But any time you learn new idioms in a new language, your understanding of programming gets better I suppose.
Re:The State of Go by watwut on Sunday February 05, 2017 @04:32PM (#13574759)
Is there a good resource where those good transferable go idioms are written? I dont think I will have time to learn go anytime soon, but would definitely spent time with an article or something like that.
Re:The State of Go by dvirsky on Sunday February 05, 2017 @04:54PM (#13574868)
Not that I know of, but Go is super easy to learn. You will get a grip of the basics and be productive over a few hours or weekend at most, and one or two hobby projects later you'll learn to appreciate the stuff I'm talking about.

BTW I've only felt I really knew the language and its inner workings and idioms deeply - after much longer, maybe a year and 2-3 big projects. But you get very productive very fast.

Re:The State of Go by matt_wulfeck on Sunday February 05, 2017 @06:17PM (#13575322)
Not only that, but rarely am I supporting a library that I'm the sole developer on. Go takes away so much "individuality" of code. On most teams I've been on with Python and Java I can open up a file and immediate tell who wrote the library based on various style and other such. It's a lot harder with Go and that's a very good thing.
Re:The State of Go by dvirsky on Monday February 06, 2017 @04:12AM (#13577816)
Yeah, at times the obsession of gophers with "idiomatic code" is annoying. But when you read someone else's code and it's idiomatic, you almost immediately have an intuitive sense how it works and can understand and modify it easily. Compared to Java OO code where you have to start chasing inheritance layers to find out where the piece of logic you're actually interested in resides...
Re:The State of Go by AnimalMuppet on Monday February 06, 2017 @06:08PM (#13585204)
Well, "idiomatic code" can often mean "for what you're trying to do, there is a way that works with the language better than any other way; do that". That is, it often means "working with the tool rather than fighting it". So, yeah, do it the idiomatic way unless another way is clearly better. (Idiomatic ought to win if evaluating "better" gives you a tie, because idiomatic will be more readable.)
Re:The State of Go by Zancarius on Thursday February 09, 2017 @05:40PM (#13611707)
I never really stopped to think about it until I read your comment, but I just realized the same applies to old Go code. As some of mine is approaching probably close to 2-3 years (and few things I haven't touched or looked at since!), and while it certainly could be rewritten to be better, it's interesting that Go's partial enforcement of idiomatic authorship appears to reduce the number of WTFs generated as a consequence of atrophy over time, to say nothing about how much less time is spent understanding the code.

Perhaps it's psychosomatic, but it sure seems easier to pick up something written in Go--long since forgotten--than it is in other languages. Then again, maybe it's also that Go taught me to substitute cleverness with terseness. The advantage here is that I've never been especially clever.

Interesting!

Re:The State of Go by systems on Sunday February 05, 2017 @05:26PM (#13575059)
i think a couple of years of experience and learning a new language .. was a far bigger factor than any intrinsict characteristics of go
Re:The State of Go by dvirsky on Monday February 06, 2017 @03:09AM (#13577494)
Not sure. the diff between 12 to 14 years experience is not like 2 to 4 years.
Re:The State of Go by Paradigma11 on Sunday February 05, 2017 @03:07PM (#13574287)
The type system is an integral part of the language.
Re:The State of Go by mirekrusin on Monday February 06, 2017 @06:49AM (#13578581)
That was true until things like optional typing as seen in flowtype/typescript came along.
Re:The State of Go by chias on Sunday February 05, 2017 @02:23PM (#13574030)
Not sure why this is being downvoted without comment, considering that it is what accounts for the example that the parent comment chose.