Google. This is a pretty big drawback for me, personally.
While structural typing seems good to me, I’ve been on the extremes too long; full-on duck typing or crazy Haskell static typing seems to fit my brain better. Dunno about this one, either.
So, Go fans, I know there’s a lot of you here. Pitch me: why’s Go super rad?
I have to note that I haven’t really seen much of Google in this. I think that it has reached its own momentum at this point.
Here’s a few things I love:
Built in, extremely easy concurrency with channels and goroutines. CSP isn’t the only way to do concurrency (see Erlang, for example) but they have made their choice and done well with it.
The compiler is extremely fast, and you have the benefit of compiled code instead of running on top of a VM or interpreter.
There is a rich standard library.
It’s a little early in the morning, so I’ll probably start adding more stuff later.
I have this as a precommit hook in my projects as the last step – if everything builds, it is formatted properly before being committed. I find this to be quite a useful way to ensure I meet the standard.
One thing I liked about Python (even if I disagreed with some aspects) was PEP 8 and having tools such as the eponymous tool to check for violations and pylint.
Adding to what Kyle said, I also like the following:
functions can be tied to data (struct, custom-type, etc)
composition over inheritance. You compose data via embedding, instead of inheriting like in traditional OO systems (at least those I have been familiar with). This seems more right to me. I feel like I am constructing/building things I need/want, instead of creating taxonomies. I find this also seems to make refactoring a bit more straightforward for me.
interfaces are more of ‘has a’ vs ‘is a’ type checking. By this I mean a type fulfills an interface if it has the right functions, as apposed to having the right class graph. This ties in with composition to make things nicely reusable.
io is async but blocking (it blocks only the goroutine). This makes code easy (for me) to reason about. It has a similar feel to python+gevent coroutines to me.
constructs you see everywhere. I’ve found that to be less painful over time, and to be a good way of checking my assumptions while writing code v. while running it.
Yeah, the error handling is verbose and a bit boilerplate. It seems to at least read well, and blend into the code fairly evenly. It is usually a bit easier to spot code not handling errors well too, which is a nice change from my experience with exceptions where I often have to hunt around to see where the exception may percolate up to.
So Go kinda intrigues me, but two things:
So, Go fans, I know there’s a lot of you here. Pitch me: why’s Go super rad?
I have to note that I haven’t really seen much of Google in this. I think that it has reached its own momentum at this point.
Here’s a few things I love:
It’s a little early in the morning, so I’ll probably start adding more stuff later.
I do really, really, really, really love the idea of
gofmt.I have this as a precommit hook in my projects as the last step – if everything builds, it is formatted properly before being committed. I find this to be quite a useful way to ensure I meet the standard.
One thing I liked about Python (even if I disagreed with some aspects) was PEP 8 and having tools such as the eponymous tool to check for violations and pylint.
Adding to what Kyle said, I also like the following:
functions can be tied to data (struct, custom-type, etc)
composition over inheritance. You compose data via embedding, instead of inheriting like in traditional OO systems (at least those I have been familiar with). This seems more right to me. I feel like I am constructing/building things I need/want, instead of creating taxonomies. I find this also seems to make refactoring a bit more straightforward for me.
interfaces are more of ‘has a’ vs ‘is a’ type checking. By this I mean a type fulfills an interface if it has the right functions, as apposed to having the right class graph. This ties in with composition to make things nicely reusable.
io is async but blocking (it blocks only the goroutine). This makes code easy (for me) to reason about. It has a similar feel to python+gevent coroutines to me.
go fmt is indeed awesome.
I also love how it feels like there is a lot less boilerplate. The one exception is the
constructs you see everywhere. I’ve found that to be less painful over time, and to be a good way of checking my assumptions while writing code v. while running it.
Yeah, the error handling is verbose and a bit boilerplate. It seems to at least read well, and blend into the code fairly evenly. It is usually a bit easier to spot code not handling errors well too, which is a nice change from my experience with exceptions where I often have to hunt around to see where the exception may percolate up to.
It is; but it comes with a bonus: if you want to pass errors up the call stack, you can: