Live data from Hacker News

Why Go is my favorite programming language

michael.stapelberg.de

41–50 of 256 posts

Re: Why Go is my favorite programming language

#41
post #26
post #21

I have said it before and I will say it again - for all the deficiencies Go has, it is somehow highly compatible with the way my brain works. One point the article does not mention is the documentation. I think Go's documentation is excellent, it does not overwhelm the reader with its volume, but mostly anything one might want to know about the syntax and semantic can be answered by carefully reading through the docu…

I still do not see why somebody in their right mind would willingly prefer camelCase over using_underscore My taste is the opposite: I can't understand underscores in identifiers, it's like having hiccups inside every thought. But what saddens me is that we're still having this conversation in 2017. It would be trivial for editors to support either style, if only language designs included the concept of word separato…

> But what saddens me is that we're still having this conversation in 2017

It is a pointless but easy thing to debate about. I find Go's solution of de facto forcing a certain style on everyone a little harsh, but it is effective.

> It would be trivial for editors to support either style

Emacs has glasses-mode which displays underscores in camelCase identifiers without changing the source code. It's not the most elegant solution, and when I first heard about it and gave it a try I was working on a code base that used both camelCase and under_score, so glasses-mode actually made the code more confusing, because I never could be sure if the underscore I saw was actually there. But on a code base that uses camelCase consistently, it might help.

My point, though, was that it does not really matter that much - if you come from an underscore_heavy_background, it takes some getting used to, but that is all. Once one is used to it, the consistency across not just my own code but the entire ecosystem really pays off.

> the concept of word separator inside identifiers

That sounds like a very interesting idea. But I think it is probably nearly impossible to introduce into an existing language without breaking a lot of stuff. Perl[56] maybe, there is a package to program Perl in Latin, and if that degree of craziness is supported, I am sure it's possible - it just won't be pretty.

Lua comes to mind as well, because in Lua an identifier is just a string used as a key for hash table that holds the local environment. This is exposed to Lua scripts, with enough cleverness one might add something there, too.

And there's probably a couple more that I missed. ;-? Has anyone actually done any experiments/research in this area?

Re: Why Go is my favorite programming language

#42
I've been using Go for a while, and am frankly amazed at the quality of the tooling.

I'll add something others haven't mentioned... the profiler produces an absolutely amazing graph of the run-time call tree[0]. This makes it incredibly easy to not only see where the code is spending its time, I can easily the context, and where else time is being spent. I recently sped some code up (5x!) using this.

0: https://blog.golang.org/profiling-go-programs

Re: Why Go is my favorite programming language

#43
post #35

Earlier quoted context omitted.

With the exception of channels, Go doesn't add much when compared to other languages. It doesn't add things, it takes them away, notably exceptions, inheritance, generics. I disagree that's short sighted, it's precisely for long term maintenance that it becomes important to have less ways to do things. You may not agree with the choices, but they are not only about being easy to learn, more about being easy to read.

> It doesn't add things, it takes them away, notably exceptions, inheritance, generics. s/exceptions/error handling/ What Go proposes is awful for a modern language.

Go has error handling, it doesn't have exceptions for non-exceptional error cases.

Re: Why Go is my favorite programming language

#44

Earlier quoted context omitted.

Sadly our entire industry is based around being short sighted. Quick to learn is only important if you have the lack of patience to spend the time to learn something you'll be using for years.

Our industry is hugely based on illusions and misconceptions. There are only few places on earth where people regularly rebuild the skyscrapers to build taller ones. The IT industry simply forces you to re-learn the same old paradigms in a new package just to gain 0.1% of something we cannot even define as an improvement.

Quite common in fashion driven industries.

Re: Why Go is my favorite programming language

#45
post #17

I'm kind of wondering about why is there no production ready JavaScript/TS to exe compiler that packages all dependencies and creates a single executable - like go. With the amount of mind share that js ecosystem has, I thought that would be a thing. The keyword being "all dependencies"

Something like https://github.com/zeit/pkg ?

very cool! is this production ready ?

Re: Why Go is my favorite programming language

#46

If I were to build a list of the reasons I use go, it wouldn't be terribly different than this one. But interestingly, while I program go every day, I sort of hate it as a language. You'll note this list doesn't actually have much to do with the language per se, the only point directly related to that is that go has a short list of reserved words (which is true of most languages). So for future language designers (or…

> go has a short list of reserved words I use go a lot now. However, I must admit I find the use of interface{} "aka empty interface, aka void*" a weird one. It's technically correct, but it's an odd semantic.

I know this is repeated often, but only because it apparently still has to: interface{} is very different from void*. It carries type-information with it. That makes it safe.

Re: Why Go is my favorite programming language

#47

If I were to build a list of the reasons I use go, it wouldn't be terribly different than this one. But interestingly, while I program go every day, I sort of hate it as a language. You'll note this list doesn't actually have much to do with the language per se, the only point directly related to that is that go has a short list of reserved words (which is true of most languages). So for future language designers (or…

> go has a short list of reserved words I use go a lot now. However, I must admit I find the use of interface{} "aka empty interface, aka void*" a weird one. It's technically correct, but it's an odd semantic.

interface{} carries runtime type information in its internal double-word (type + pointer) structure, unlike void*.

Re: Why Go is my favorite programming language

#48
post #21

I have said it before and I will say it again - for all the deficiencies Go has, it is somehow highly compatible with the way my brain works. One point the article does not mention is the documentation. I think Go's documentation is excellent, it does not overwhelm the reader with its volume, but mostly anything one might want to know about the syntax and semantic can be answered by carefully reading through the docu…

"for all the deficiencies Go has, it is somehow highly compatible with the way my brain works."

I have been tempted to write a blog post about "Why People Actually Can Write Real Programs In Go." To listen to HN complain about the language you'd think that it must be clearly impossible to ever write a program of any kind without massively copying and pasting everywhere, when in reality I find it's actually quite pleasant for a non-trivial subset of programs.

The short answer is that it has a lot of features that people, generally not being used to them, work better than people may realize from the bullet points and often work together better than people realize. Favoring composition over inheritance is a legitimately good choice. Being able to declare interfaces that other objects I don't control conform to has a lot of little effects that you wouldn't anticipate in advance, to the point that while I understand the bondage&discipline impulse to require code to declare what interfaces it supports, I would consider that a legitimate mistake in most of the languages that do that. (In practice, it turns out the problem of "accidental satisfaction" basically doesn't exist. We learned that from the duck typing languages like Python and how they never really had a problem with that.) And while the grand concurrency stuff may seem neat, the little stuff can be nice too; just yesterday I wrote some code that takes a list of servers to query for some particular thing, and it was easy to write it to do them all simultaneously; that wasn't a Grand Architecture thing, it was just a function that casually did something that is a royal pain in many languages. (There are also languages that can do it better; I actually know many of them. Erlang would be roughly a tie here and Haskell could look really awesome if you put a bit of work into it. Elixir might beat Go, not sure, but I know Erlang itself doesn't.) And there's some other things like that.

The other thing about Go is that I like it for work, but not necessarily for my hobby. The thing about all those restrictions in Go that apply to me is that they symmetrically apply to my coworkers. As much fun as a more powerful language can be, it becomes a lot less fun when you've got dozens of developers trying to work in one code base in those languages; what is power for you is power for them, too, and, well, let's just say they are not always going to be the most expert developers in the world. I've seen... things. And at times, I've even been the one who did the "... things". So even though I know how to use Haskell productively and generally correctly, I'm generally very uninterested in introducing it into the team environment that I have. This is, IMHO, a very important point that I don't hear discussed often enough.

Basically, if you take HN's opinion of "Go is useless and should be wiped from the face of the Earth" as a scientific theory that predicts how useful it would be, the theory is falsified. It is useful and some of us even enjoy it for certain tasks. But I for one would never suggest it is useful for everything and actually frequently warn people off from certain tasks.

Re: Why Go is my favorite programming language

#49
post #43
post #35

Earlier quoted context omitted.

> It doesn't add things, it takes them away, notably exceptions, inheritance, generics. s/exceptions/error handling/ What Go proposes is awful for a modern language.

Go has error handling, it doesn't have exceptions for non-exceptional error cases.

Go has functions with multiple return values. That's not at all the same.

Re: Why Go is my favorite programming language

#50

The "easy to learn" argument is getting old. If the cognitive load never decreases, that's one thing, but initial ramp-up time shouldn't be a large determining factor. The MVC pattern, ADTs, functional programming, and so many other useful concepts were foreign at first, but have a substantial impact on how you think and work. With the exception of channels, Go doesn't add much when compared to other languages. Maybe…

It matters for large teams and when you got hundreds of languages to choose from. I am sure Haskell is great but after a couple of weeks studying it I realize I don't have time for something I don't know if will pay off or not. In contrast with Go you can see benefits almost immediatly

Two weeks is a tiny investment to properly evaluate a language. Haskell is tripping you up because you're likely new to proper FP and very strongly typed languages. Pushing past two weeks, even if you don't use it, will make you a better developer, and the next FP or strongly typed language will come more easily.
Post reply on HN