Skip to content

Comment on A Grumpy Guy Complains About Complaining

Comments

From the article: This is like finding a new alloy of steel and then building a bridge out of it to see if its any good. If Go doesn’t have generics, and you know you need generics, why the fuck did you bother with Go? These details are widely, exhaustively documented; they are not surprises.

Well, I took a good hard look at Go, and I said, "There's a lot of stuff here that's really, really sweet, but error handling is going to require 600 gross conditional statements, and I'm going to have to rewrite common algorithms over and over and over because there are no generics."

But lots of people in Go community kept saying, "Yes, it looks a little unusual, and it doesn't have all the features you'd expect, but you need to give it a fair chance, and try writing a real project or two in it. Don't be a blub programmer, afraid to try out strange new abstractions."

So I wrote a couple of medium-sized programs in Go, including a server which broke simple substitution ciphers (to help perform OCR on subtitles). This involved a lot of tweaking of algorithms and optimizing. This was maybe my second or third medium-sized Go program.

And maybe about the third time I had to tear apart the server and rewrite it, and said, "This whole experience is actual incredibly painful. Why does this code keep hurting me every time I need to redesign something?" So I paid closer attention, and I said, "You know, my code is buried under error-handling conditionals and lots of stupid little subroutines that should be in standard library—but which can't be there, because there are no generics."

Seriously, if Go had Erlang OTP-style error-handling and some ruthlessly-simplified generics, I would use it all the time. The type system rocks, the basic data structures are excellent, and the standard library is good. It's clearly well-optimized for writing certain types of programs. It's just I don't write those programs very often.

It turns out what I want is a lot closer to Elixir: Erlang concurrency semantics, decent Unicode string handling, some light metaprogramming and a Ruby-like syntax. Too bad Elixir is still so young and obscure.

I'm with you here. Golang has a lot going for it, and it isn't shy about its shortcomings, but the story is "Try it, you'll like it." After a year, I still find myself bogging down coding things which should be easy and expanding my SLOC because of warts in the language.

As someone who learned C in the pre-ANSI language days, in the pre-POSIX library days… I have high hopes for Go 2.0, whatever that ends up being.

If you know Go doesn't have what you need, then why did you use it?

Sometimes, a language isn't a good fit for what you're building, and you said that yourself, you don't write those programs very often.

And some other times, a language just isn't for you, it doesn't match the way you think about programming.

For example, I tried to learn Scala a lot and it just didn't work, so I stopped trying because there are better uses of my time than saying: "I wish language X had feature Y" or "I wish language A was more like language B"

If Elixir has what you need, then by all means use it. Nobody knew Python before Google started using it, didn't stop them from doing great things with it.

I think he answered why he used it pretty clearly in paragraph 3: because people in the Go community told him he had to use it for a bit to give it a fair shake.

Another way of saying it: he couldn't have known it didn't have what he needed until he tried it. So he tried it. Which I think is great. There are lots of thing we think we need that we don't, and lots of things that we never knew we needed until we tried them.

A language with everything would be a nightmare. To program efficiently you need a balance between capability and mental footprint. If I have to write large amounts of code to accomplish a task, that is bad for me and the eventual reader. If I use some feature so esoteric the read has to stop and research, or worse, misunderstands that is also a problem.

The Go promise is that they don't have some things, but you won't miss them. Some are deliberate omissions, some are deferred until they decide if they are required and can sanely be implemented. How those impact you is going to depend on what problems you are solving.

The danger is to end up wanting language casserole with bits and pieces from everywhere. It might be what you want, but by the time you union that with everyone else it is too big to know.

You don't go in saying "I need exceptions. I will use Go!" You start down the road saying, "I used to use exceptions, but in Go I will explicitly check all the errors." Only with experience can you look back and see what the cost was.

A library for what you need - e.g. language features in library... but then that would be some form of lisp :)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.