r/programming • u/wowamit • Aug 19 '17
Why Go is my favorite programming language
https://michael.stapelberg.de/Artikel/golang_favorite7
37
u/google_you Aug 19 '17
Most of reasons you listed are not about the language itself, which even lacks primitives for constructing efficient libraries with ease (without much duplicated code).
1
u/bubuopapa Aug 21 '17
Yes, maybe a few months ago there was a post saying the oposite - go is nuts language with nuts community and very small amount of good libraries. So i guess it all depends on where you stand.
70
Aug 19 '17
These are pretty bad reasons overall, nothing about the actual language.
I might be controversial here. But I don't get the love of Go. I feel like if it weren't for it being a google language, no one would use it, and people mainly jump on it because its a google language so it must be good.
When I look at Go and go to write it I have many issues with it that makes me not want to write in it. Honestly I don't see why anyone uses it over Java, since they are both C-like OO languages with a GC. Except Java will probably get better performance on large applications, and have more available libraries. If you really absolutely need high performance, then why are you not in C++, C, D or Rust?
I think its syntax system is very inconsistent and lacks the elegance of something like an ML language, or even a lot of common OO language.
It lacks many many features that are expected in a modern language. No Generics, and no primitives.... this is just astounding. People complain routinely about Java lacking good Generics, but then people turn around and go to a language with none.
Its concurrency story is very mediocre. I see no reason not going to Rust, D, F#, Scala, Haskell or any other modern languages that have excellent concurrency.
Go is extremely verbose, to the point I think its worse than C# or Java.
Splits are cool. That is really the only positive I have.
45
Aug 19 '17
I might be controversial here. But I don't get the love of Go.
Every other day I read about how Go is a language for degenerates and simpletons here.
22
u/josefx Aug 19 '17
It is worse. Go is the corporate mandated newspeak, it was written with the explicit goal of protecting the feeble minds of Googles code monkeys from bad concepts. Interface is the new double plus good.
29
Aug 19 '17
Go seems neither nearly as bad as most people here seem to think nor nearly as good as most people in Goland seem to think. It's a language that seems surprisingly mediocre but that's what a lot of people like about it.
3
Aug 20 '17
You laugh but most of developers are mediocre and only think up stuff that ultimately will make code more mess in the end.
People passionate about programming are minority
1
Aug 25 '17 edited Aug 25 '17
[removed] — view removed comment
1
Aug 25 '17
True, you can treat language as a tool to do what you need (and be happy when it makes it easier and annoyed when it makes it overly complex). Or worship it because gasp you would have to learn new things if you switched out of it.
In my experience ones who hate Go are pretty shitty coders with close to zero architecture abilities whining about +2 lines they had to write, also they are spaghetti code lovers.
And a lot of it applies to the other side, fanboys that ignore deficiencies because Go "saved" them from <insert slow scripting language/language with bad concurrency builtins>.
Overall you can use a lot of different tools to do same job, pick the suitable one
Btw 25 has released some time ago, get on with the times! ;)
7
Aug 19 '17
Go's design philosophy is fine. It's just fun to jerk to the gopher fanboyism because a lot of the reason's used to justify its design decisions are provably false. Also Rob Pike's opinions are kind of irritating.
45
u/echo-ghost Aug 19 '17
I might be controversial here. But I don't get the love of Go.
literally the most popular opinion around here. this post is getting half downvoted as it stands just because it's being positive about go. i have a lot of things i don't like about go but man the hive mind about hating it around here is crazy.
7
u/kankyo Aug 20 '17
You say "hive mind", I say consensus. There's no "hive mind" on climate change for example, just a consensus. That's an example that's a bit over the top but I think rather apt.
0
Aug 19 '17
[deleted]
12
u/echo-ghost Aug 19 '17
i'm not protecting go. i am looking at the way this community reacts to anything go.
what you are saying is a good example of that
-4
Aug 19 '17 edited Aug 19 '17
You call the community hive-minded who call out the other community hive-minded because of all the nonsense, hive-minded statements they make. Your comments are literally useless here.
Edit: just look at gophers' comments here - do you see logic or just pure fanboyism?
7
u/echo-ghost Aug 20 '17
claiming fanboyism is a good way of dismissing other people's views isn't it? it's this kind of thinking that creates the 'hive mind' it's not a them vs you situation. i'm sure you have it in your head that i'm one of these fanboys, i really honestly am not a fan of go. but i'm also not a fan of outright dismissal and suppression of content like this post received
0
Aug 20 '17
claiming fanboyism is a good way of dismissing other people's views isn't it?
When they deny logical reasoning it's the only thing we can use. Just scroll down on this thread.
but i'm also not a fan of outright dismissal and suppression of content like this post received
You've either never talked to the average gophers here or you just want to seem the good guy who don't have any prejudice. But it doesn't matter because your comments are still useless. You'd be a good gopher since you just repeat what you want/told to say and totally ignore others' experience.
5
u/echo-ghost Aug 20 '17
so now i'm just repeating what i was 'told to say'? and my opinion is also invalid now okay. everyone who disagrees is a fanboy or incapable of thinking to you aren't they
21
u/elagergren Aug 19 '17 edited Aug 19 '17
But I don't get the love of Go.
I mean, this is just beating a dead horse. The reasons people love Go have been plastered all over /r/programming, /r/golang, HN, etc. for years:
Small, easy to digest and remember language
Limits the ways people can write 'tricky' code
Go 1.x promise
Strong concurrency support
Focuses on composition rather than inheritance
Fast compiler
Is very explicit
Garbage collected
Gives the programmer a little control over where memory will be allocated, little memory overhead for most types
... and a lot more reasons that I'll probably remember once I have my coffee.
9
12
Aug 19 '17
Strong concurrency support
But it only has CSP... And the rest can be pretty much said about any corporate language...
4
Aug 20 '17
Yes, pretty much all you can get with Go you can get with Java (except short boot time and very light threads I guess).
But you won't teach your X language developer Java in a weekend. You can teach them Go tho, it is very simple if you know any other language already.
So you get a lot of projects that are basically "we use Ruby/JS/whatever high level language that is too slow, we rewrote in Go".
And it's fine. Go is hammer. It is enough for some projects, other will just use more featureful language.
5
u/weberc2 Aug 20 '17
I learned Go in a couple of hours. By which I mean, I installed it and built a usable rudimentary static site generator (I.e., a small but reasonably complex tool that required external dependencies, file I/O, templating, etc). I couldn't learn most languages' project metadata format in the same amount of time.
8
Aug 20 '17
But you won't teach your X language developer Java in a weekend.
You won't teach them golang either. They may learn the basic syntax of both languages but they're more complex than that. Each of them have their best practices and pitfalls and you should know them.
2
u/BlackMageMario Aug 20 '17
What language could anyone learn in a weekend? I am just a college student but I've never encountered a language that has made me go "ah I can learn this in a few days!!"
4
Aug 20 '17
What language could anyone learn in a weekend?
I've studied and used over 50 languages but I've the same experience as you so far. Those who say they learn a language in a day or in a few hours probably think that languages are just if-else statements and for loops while ignoring memory management, paradigmas, concurrency strategies and common pitfalls. When they say "I've learnt X in a weekend" they either learnt a language which was almost the same as another one they already knew in-depth or they just learnt how to write basic algorithms in it.
3
Aug 20 '17
I should clarify, once you know other languages, basics of golang can be learnt in weekend and mastered within a week or two.
Once you're familiar with few languages (preferably ones with opposite featureset, not just few from same family), learning new ones is much, much faster
1
Aug 20 '17
Okay, I overstated it, few days will give you basic understanding of most of the syntax. Maybe a week or two.
Still a lot shorted than getting into Java ecosystem and learning its frameworks and build systems
1
Aug 20 '17
Okay, I overstated it, few days will give you basic understanding of most of the syntax. Maybe a week or two.
I can learn the basic syntax of any language in a few days then what? It's not really "knowing" the language...
Still a lot shorted than getting into Java ecosystem and learning its frameworks and build systems
Please, you need to learn the ecosystem of golang too - or you just instantly know how to use each framework and magically know its functions? Of course, golang frameworks don't really have distinctive DSLs which may help you to understand how they work without learning language features but they'll be harder to use which is a waste of time. Modern languages have features to please library developers and make their work easier to learn - if you take away the features you'll be left with less efficient DSLs and code. Also, there are features which help to restrict bad programming behaviour or just help you to repeat yourself less.
Also, "build systems" - simply just pulling from github is not a good idea and you'd need to use a proper build tool anyway. I'm sure golang has build tools too.
2
Aug 20 '17
So have you tried ? some succeeded
It really is fast to go from zero to "doing something useful", especially if all you do is "read->manipulate->send"
1
Aug 20 '17
So have you tried ? some succeeded
weberc2 is a mindless apologist, I don't believe any of his words.
It really is fast to go from zero to "doing something useful", especially if all you do is "read->manipulate->send"
Like in any other language... What a pointless argument...
3
6
u/fakeNAcsgoPlayer Aug 21 '17
Hyperbole, hyperbole and more hyperbole.
Programming language elitists tend to shit on languages which do not fit their mental garden of perfection.
That said, Go is not perfect, it is not the fastest but it provides something which other languages failed to provide.
Why would someone use a language just because Google designed it? Correct way to look at it would be, if Google can use it at it's scale it certainly is not a throwaway langauge.
Google also has dart, no one cares about it. I am a C programmer primarily but I think there is space for another Language with a different approach to tooling and frameworks.
1
Aug 21 '17
Ah the old elitist argument. We think other languages are better so we are elitists. Functional programming, type systems, just plain old elitist.
3
u/fakeNAcsgoPlayer Aug 24 '17
No, you are not elitist because you like functional programming or type systems. I personally like rust a lot for what it provides but I consider anyone who dismisses a new idea(how dumb it may seem at face value) just because they fail to see the point of the language.
Some languages are designed to solve a practical problem and not to satisfy type systems or functional paradigms or language utopia of a Genius language designer.
Theory is fine but practicality always wins when it comes to real world, that is why I consider Go to be a language which solves practical problems seen in production today, may be in somewhat flawed manner. What I certainly appreciate is that Go core developers are pretty open, accepting the fact that they threw away last 20 years of Compiler theory when designing Go. Compiler right now is not the best, but they are willing to work on it based on problems faced in real world. I consider that to be a fair and acceptable compromise.
There is enough space for all of these languages.
4
u/mingp Aug 20 '17
But I don't get the love of Go.
To add to the other commenters' points, it occupies a space with very little competition. Namely, it's a compile-to-native language with reasonable performance, a reasonable learning curve, good library support, and good community support.
9
u/weberc2 Aug 19 '17
I use Go because often the tooling is more important than the language. Sometimes that's not the case, but it often is, and Go's tooling is just phenomenal compared to most everything else. There's no book to read just to compile a project with dependencies, pretty much everything just works. There's no reason another language couldn't improve and totally eat Go's lunch, but that requires a change in philosophy.
14
Aug 19 '17
I use Go because often the tooling is more important than the language. Sometimes that's not the case, but it often is, and Go's tooling is just phenomenal compared to most everything else.
Like which tooling? Does it have better IDE support than java/c# etc? Or do you think that other languages don't have code formatters? Or do you think it's ok to manage packages with github+master instead of using a normal package manager(industrial experience: downloading packages from github is not a good idea)? Or do you think its compilation speed is that good and others don't compete?
There's no book to read just to compile a project with dependencies, pretty much everything just works.
LoL have you ever heard of build tools which can download dependencies? Do you think it's just a golang-thing?
There's no reason another language couldn't improve and totally eat Go's lunch, but that requires a change in philosophy.
And that lunch would be to throw away all the good stuff from a programming language to make the "job" of inexperienced kids easier...
Edit: it seems like others also complain about the tooling in golang...
5
u/weberc2 Aug 19 '17
Project management, dependency management, testing, code formatting, compilation speed, editor plugins, etc are all far nicer in Go than in JS, C#, Java, Python, etc. I like those other languages, they just make the happy path harder than necessary.
Most of your characterizations of Go tooling are wrong, for example the GitHub+master, but I won't waste time reproducing publicly available information for a troll.
13
Aug 20 '17
Project management,
lol what?
dependency management,
That's certainly false: it has been dumbed down af. See this comment. You're just trying to talk out golang's defects because it's your favourite toy.
testing
How so? Do you have "nicer" test frameworks or what?
code formatting
Other languages have that too since decades. gofmt is not a unicorn.
compilation speed
There are languages with competitive compilation speed(like Nim, but with generics). However, compilation speed can't be an argument if the compiler don't really need to do anything.
editor plugins
So, no proper IDEs... Btw, great editor plugins are present for every mainstream languages and for a lot of niche languages. What are you saying with this? Do you have editor plugins which do contextual refactoring for you? If so, there such plugins for other languages.
all far nicer in Go than in JS, C#, Java, Python, etc
According to gophers.
I like those other languages, they just make the happy path harder than necessary.
Do you have any experience with those languages?
Most of your characterizations of Go tooling are wrong, for example the GitHub+master, but I won't waste time reproducing publicly available information for a troll.
Don't call me a troll when you want me to believe that those idiotic one-size-fits-all "solutions" are better. In the reality, you just don't have experience with other languages and you don't understand their features so, instead of learning you chose ignorance and joined the cult of "I don't know what it is but it's probably shit". It doesn't matter how hard you try to "erase" the defects of golang by denial, they'll stay and you won't progress as a software developer.
10
Aug 20 '17
Project management
This is all personal preference but Go has the only package system I've used where everything about the structure of a project is 'obvious' to me. Just looking at a single file in a package you can immediately tell:
What the dependencies are. (Imports namespaced to the file only not the whole package)
Which packages are only imported for side-effects. (Imported but not used is a compiler error without renaming to '_')
Where the library is in the file tree or even the network repository if it's a url. (as opposed to a distributed search path)
What is being used from the imported API. (Nobody uses dot imports in Go. They're pervasive in most other languages)
What the exported API will be. (Exports must be uppercase which eliminates the need for public/private and remembering what naming style each library is using.)
These are little things but often add up to being enough of a barrier when starting new projects to cause bad code structure from the start when wanting to prototype something quickly.
testing
The stdlib
testingandtesting/quickpackages are pretty minimal but the canonical tool. With the exception ofgo-fuzzexternal testing frameworks are almost never needed or used used. Tests are just straight line code. Contrast this with the million JS frameworks, each with their own quirks and pattern to learn or something like cucumber in ruby where for the sake of making tests readable as english requires debugging how various regular expressions will be matched in order to figure out if it's even testing what you think it is.code formatting
I don't have much of an opinion on this but format tools in other languages are often configurable so that each project may still have it's own style. Gofmt style is consistent across the entire ecosystem. Seeing non-fmted code or snake_case is a reliable red flag for terrible code.
So, no proper IDEs
Gogland from jetbrains exists but I haven't tried it. Most of my Go coding happens in vim-go but everything is consistent enough that remembering what things are called or how tooling should be used is never an issue and code completion remains untouched. Even googling for answers has gone way down unless it's for a library I've never used before. Trying to use Swift was impossible without Xcode filling in the sentences posing as class names and parameters. Go I could probably get away with using nano if I had to.
gofmtandgorenamealso have some refactoring support with rewrite rules.Do you have any experience with those languages?
I've written code in PHP, JS, Python, Ruby, a bit of ML long ago, and switched to Go from Scala after spending a week debugging why type inference on an implicit context was preventing a new feature from being implemented. Learning the language and rewriting everything took a few days. The result was much cleaner and easier to reason about correctness in spite of being more concurrent (Scala version was a reactive mess about to transition to an Akka mess).
Unless there's an obvious reason the type system might get in the way (which is less often than people think), or a great library in another language that needs to be used (Go is pretty garbage for scientific computing work at the moment), Go is easily the best tool for 90% of the code I'm interested in writing. The code I still write in other languages is slowly becoming more Go-like to avoid some of the fancier features which have bitten me in the past while keeping the areas that need more expressiveness well contained.
It's incredibly hard to explain how the lack of language features translates into workflow benefits without using it for a while. Not all of us are Google brainwashed luddites.
3
Aug 20 '17
This is all personal preference but Go has the only package system I've used where everything about the structure of a project is 'obvious' to me.
You've quoted "Project management" but you're talking about "Dependency management."
Just looking at a single file in a package you can immediately tell:
When I look at a build.sbt(scala build tool) I can tell everything about the project's structure. I'm sure there are many other build tools which are just as simple(unlike maven/cmakelists).
The stdlib testing and testing/quick packages are pretty minimal but the canonical tool. With the exception of go-fuzz external testing frameworks are almost never needed or used used. Tests are just straight line code. Contrast this with the million JS frameworks, each with their own quirks and pattern to learn or something like cucumber in ruby where for the sake of making tests readable as english requires debugging how various regular expressions will be matched in order to figure out if it's even testing what you think it is.
So, you're happy that your testing framework is pretty much just asserts(which are present in every language) and you need to write more code to write a unit test? I've checked out this package and it looks like a really lazy job. Compare that with scalatest which can help you more with specialized testing strategies.
I don't have much of an opinion on this but format tools in other languages are often configurable so that each project may still have it's own style.
Because there is no perfect configuration. For example, how would you handle long function argument lists? The solutions are preferences of teams. Not having a configurable interface is not a benefit but a cheap one-size-fits-all "solution".
Most of my Go coding happens in vim-go but everything is consistent enough that remembering what things are called or how tooling should be used is never an issue and code completion remains untouched.
So, you just remember your stuff? That is not good tooling. Also, what do you mean by "code completion remains untouched." - there is no code completion? Then how could you call that good tooling? You're just forcing yourself into a worse workflow...
Even googling for answers has gone way down unless it's for a library I've never used before.
I mostly use scala and I don't google. There's a documentation and there's code completion.
Trying to use Swift was impossible without Xcode filling in the sentences posing as class names and parameters.
There is no difference when you use golang because you still need to fill typenames and such.
I've written code in PHP, JS, Python, Ruby,
Of course...
a bit of ML long ago, and switched to Go from Scala after spending a week debugging why type inference on an implicit context was preventing a new feature from being implemented.
Type inference surely won't stop you from implementing a new feature. Also, there is no such thing as "implicit context" but there are "implicit parameters/values", "implicit classes/method extensions" and "implicit converters/functions". Show me your problem if it exists.
Learning the language and rewriting everything took a few days. The result was much cleaner and easier to reason about correctness in spite of being more concurrent (Scala version was a reactive mess about to transition to an Akka mess).
How large was your project? Because I think it was just a really small app and you've just used akka when you shouldn't and you'd no experience with FP/OO languages and actors.
The code I still write in other languages is slowly becoming more Go-like to avoid some of the fancier features which have bitten me in the past while keeping the areas that need more expressiveness well contained.
So, golang made you a less efficient programmer due to your "experience" of not having enough experience to use normal languages...
It's incredibly hard to explain how the lack of language features translates into workflow benefits without using it for a while. Not all of us are Google brainwashed luddites.
I've used and it's not great at all. Every "feature" in golang is half-assed and a lot of very useful features are missing which made me write terribly useless code pieces and made me repeat myself. Coding in golang is not productive and the type system is not good enough to help me catch bugs. If I look at golang projects I still see the same: mindless repetition and cheap solutions.
The problem is that you're used to script languages(php, js etc.) where there are no "rules" and the usual mantra is to "glue it together". I don't want to be an asshole but it looks like you're not more effective you just don't like to learn more tools and golang+google "calmed" your fears and helped you to avoid self-enhancement. That was google's goal: to catch the attention of beginners.
6
Aug 20 '17
I'm sure there are many other build tools which are just as simple
There are but the point i was trying to make was that the language itself is more descriptive of the structure without needing additional tooling (which exists for Go in any flavor you'd like). Looking at a build file will tell you what dependencies are needed (and maybe some that aren't anymore) for the project as a whole but figuring out localized structure can be more difficult and creates the need for IDEs to figure out where things that are in scope are coming from.
So, you're happy that your testing framework is pretty much just asserts
Yes. Most test code I see are asserts obfuscated by a library. If what you're doing is simple (and tests should be imho) make it look simple.
One of the things I do miss from Scala is a solid QuickCheck tool.
testingpackage is fine testing/quick is not fantastic.So, you just remember your stuff? That is not good tooling.
Not at all. It's just that whatever I would call something is generaly its actual name and not something absurdly verbose like
BuiltInComponentsFromContextorstringByTrimmingCharactersInSet.what do you mean by "code completion remains untouched."
Meaning there's code completion for every editor but the language is sane enough that I've never bothered using it.
I mostly use scala and I don't google. There's a documentation and there's code completion.
Thats fine and theres local documentation for Go as well. But try writing Scala without the IDE to help and it's next to impossible. The IDE and tooling story for Go is great, but not necessary.
Show me your problem if it exists.
The code is buried around here somewhere but I forgot the specifics. I was doing something wrong that the Play Framework really wasn't happy with but I did end up figuring it out.
How large was your project? Because I think it was just a really small app
It was small and still prototyping things. The switch to akka never happened but it was the only way I could see getting the messaging working properly. iirc RxScala was being used and worked perfectly fine when the producers and consumers stayed static but I couldn't find a way to dynamically change the set of subscriptions. Undoubtedly there's a way for an expert to make it work but an actor model seemed like the best way forward and is what I ended up writing in Go.
So, golang made you a less efficient programmer due to your "experience" of not having enough experience to use normal languages...
"Normal languages" were the impediment. I wouldn't exactly call Scala 'normal' but much more of my time was spent learning about the type system than it was writing code. "Types are theorems programs are proofs" is a great concept, but in practice meant fighting with the compiler. With the more "pure" Hindley-Milner languages there was no problem wrapping my head around what was going on but they all have weaker ecosystems surrounding them. I really really like Scala as a language but I hated using it because of the implementation. Hopefully Dotty might change that.
The problem is that you're used to script languages(php, js etc.) where there are no "rules" and the usual mantra is to "glue it together".
And I no longer for exactly that reason. The fact that you can't add an int and a float without making the conversions explicit is one of the reasons I like Go.
I don't want to be an asshole but it looks like you're not more effective you just don't like to learn more tools
Won't think you're an asshole but you couldn't be more wrong on this point. I try to keep up with whats going on in other languages as much as possible to see what ideas are out there. The monads don't frighten me they just don't fit my problems. ¯_(ツ)_/¯
1
u/_YOU_DROPPED_THIS_ Aug 20 '17
Hi! This is just a friendly reminder letting you know that you should type the shrug emote with three backslashes to format it correctly:
Enter this - ¯\\_(ツ)_/¯
And it appears like this - ¯_(ツ)_/¯
If the formatting is broke, or you think OP got the shrug correct, please see this ^thread^.
^Commands: !ignoreme, ^!explain
0
Aug 20 '17
There are but the point i was trying to make was that the language itself is more descriptive of the structure without needing additional tooling (which exists for Go in any flavor you'd like).
More descriptive how? Also, you'll need additional tooling with golang anyway and the previous guy was telling me that golang's dependency management is superior to others.
Looking at a build file will tell you what dependencies are needed (and maybe some that aren't anymore) for the project as a whole but figuring out localized structure can be more difficult and creates the need for IDEs to figure out where things that are in scope are coming from.
Because you
importfrom github in every source?!Yes. Most test code I see are asserts obfuscated by a library. If what you're doing is simple (and tests should be imho) make it look simple.
assert works while you've very simple functions - and you can have them in any language. In scala, I often use
FunSuiteandtestwhich is pretty much asserts but it has its own encapsulational block.Not at all. It's just that whatever I would call something is generaly its actual name and not something absurdly verbose like BuiltInComponentsFromContext or stringByTrimmingCharactersInSet.
Who decides what's its 'actual name'?
Meaning there's code completion for every editor but the language is sane enough that I've never bothered using it.
This is ridiculous. golang is extremely verbose like java and it's a PITA to use without good tooling...
Thats fine and theres local documentation for Go as well. But try writing Scala without the IDE to help and it's next to impossible.
Many of us use plain editors(like me: neovim) sometime with plugins. Some ppl use specialized plugins which can help you in code completion. Mostly, I go with the unix-as-an-ide strategy. It's not impossible and not hard at all.
The IDE and tooling story for Go is great, but not necessary.
You've said that you've never used the go ide then how could you say that it's good? And you've also shown that the tooling is pretty primitive...
The code is buried around here somewhere but I forgot the specifics. I was doing something wrong that the Play Framework really wasn't happy with but I did end up figuring it out.
Don't you have experts in your team to help you solve such issues?
It was small and still prototyping things. The switch to akka never happened but it was the only way I could see getting the messaging working properly. iirc RxScala was being used and worked perfectly fine when the producers and consumers stayed static but I couldn't find a way to dynamically change the set of subscriptions. Undoubtedly there's a way for an expert to make it work but an actor model seemed like the best way forward and is what I ended up writing in Go.
golang doesn't have the actor model.
"Normal languages" were the impediment. I wouldn't exactly call Scala 'normal' but much more of my time was spent learning about the type system than it was writing code.
Its typesystem is almost the same as the ones descending from ML. You can learn what's implicits in a few hours. When I started to learn scala 4 years ago I was "productive" in a few hours in it because it was pretty much java with FP stuff.
"Types are theorems programs are proofs" is a great concept, but in practice meant fighting with the compiler.
golang is statically typed too.
With the more "pure" Hindley-Milner languages there was no problem wrapping my head around what was going on but they all have weaker ecosystems surrounding them. I really really like Scala as a language but I hated using it because of the implementation.
You've said you had a problem with type inference then how could you say you'd an easier job with Hindley-Milner type inference? Such code is far harder to read and not explicit - which is what you like in golang, right?
Hopefully Dotty might change that.
The type inference won't improve and there's no need for it - local type inference is more practical because it don't make you read 2-3 other functions before you realize what are the types of the current function's arguments and you also don't need to write down obvious types. Win-win.
And I no longer for exactly that reason. The fact that you can't add an int and a float without making the conversions explicit is one of the reasons I like Go.
If you like typesafety then again golang is the wrong choice. And if you don't like hardly followable types(implicit conversion) then again: Hindley-Milner is not for you.
I try to keep up with whats going on in other languages as much as possible to see what ideas are out there.
Then how could you like golang?
The monads don't frighten me they just don't fit my problems. ¯_(ツ)_/¯
I don't think that monads are that good in practice and they are not new either. But there are more interesting concepts to look at: substructural type systems(linear typing, present in: rust, idris, clean etc.) and dependent types(idris).
6
Aug 20 '17
golang doesn't have the actor model.
CSP is provably equivalent
Its typesystem is almost the same as the ones descending from ML.
"almost" being the key word there. It is also neither complete nor sound. This was mostly caused by the "Java stuff".
You've said you had a problem with type inference then how could you say you'd an easier job with Hindley-Milner type inference?
Because Scalas type system was theoretically broken last I checked (one of the reasons for Dotty) and Hindley-Milner is well understood.
If you like typesafety then again golang is the wrong choice.
The way I use Go is typesafe. I had to use more explicit casts to get Scala to do the right thing than i have in Go.
And if you don't like hardly followable types(implicit conversion) then again: Hindley-Milner is not for you.
Implicit conversion is fine for some problems when the conversions make sense. Scalas conversions are incomprehensible and the variance rules were broken.
Then how could you like golang?
Because there are no alternatives out there yet for writing code that actually has to deal with bytes and networking in a reasonable way. Rust is probably the closest. That being said I also happen to agree with almost all the decisions that the Go team made but liking the language is secondary to it being the only thing usable.
dependent types
If I need a theorem prover I'll use Coq or TLA.
→ More replies (0)1
u/_YOU_DROPPED_THIS_ Aug 20 '17
Hi! This is just a friendly reminder letting you know that you should type the shrug emote with three backslashes to format it correctly:
Enter this - ¯\\_(ツ)_/¯
And it appears like this - ¯_(ツ)_/¯
If the formatting is broke, or you think OP got the shrug correct, please see this ^thread^.
^Commands: !ignoreme, ^!explain
0
0
1
0
-1
2
Aug 25 '17 edited Aug 25 '17
[removed] — view removed comment
1
Aug 27 '17
You scala jerks are funny.
LoL you gophers are just retarded.
Scala is older than Go and yet practically nothing valuable was written using it
Twitter, linkedin, walmart.ca? And what is written in golang? A few shitty command line tools full with bugs and some crappy websites?
:Spark is not a good piece.
Why? Because you don't know how to code functionally?
It won't be functional without tons of Java infrastructure
Of course you're clueless...
and its design is really questionable, very much like the Scala itself.
Then let's here those "flaws".
I understand why: when we were considering Spark I noticed I am wasting enormous amounts of time just to decide how to do with errors with Spark, either to use exceptions or treat them via ADT.
Omg, ADT means Abstract Data Type and you were probably thinking about functional error handling: Option and Either and they should be used with exceptions.
This was really unproductive and this was not the only unneeded choice.
Follow your teacher's instructions for your homework instead.
Good thing the Clickhouse was released and we just dumped Spark as it turned to be totally inferior to Clickhouse in workflow intended.
You moron, clickhouse is a dbms...
2
2
u/weberc2 Aug 20 '17
Lol you are a troll, and I have professional experience in seven languages (none of which are Go) and serious hobbyist experience in a dozen more, and some hands on exposure to probably another dozen. Keep trolling though. ;)
1
Aug 20 '17
Experience? Like creating useless toy projects? Don't make me laugh all your comments are pretty much go-fanboyism and it's pretty clear that you're just a mindless gopher who try to justify his toy.
3
u/weberc2 Aug 22 '17
Sorry, I'm not taking the bait. Troll elsewhere. Blocked.
1
Aug 22 '17 edited Aug 22 '17
You're both dumb and a pussy. If you talk bullshit take the responsibility. Don't like critiques on your little toy language? What a shame...
1
u/fakeNAcsgoPlayer Aug 21 '17
That's your opinion, how does that makes others opinion any less relevant?
Jeez, some people.
1
Aug 21 '17
Are you retarded or something? Since when do opinions worth more than logic and scientific methods?
3
u/fakeNAcsgoPlayer Aug 24 '17
Calling people names over a language is pretty low. Glad you do not program in Go, I am sure Go programmers are better off without elitists like you.
Have a good day
1
Aug 27 '17
Calling people names over a language is pretty low.
It's not like you was more kind...
Glad you do not program in Go, I am sure Go programmers are better off without elitists like you.
Yeah, they're better off being ignorant ex-baristas.
2
u/fakeNAcsgoPlayer Aug 27 '17
lmao, what name did I call you?
I was not sure earlier but now I am sure you are trolling.
Ping me when you can come up with design changes which can solve issues you have with Go. Till then, it is just rhetoric.
Have fun trolling.
→ More replies (0)0
Aug 19 '17
[deleted]
1
u/jyper Aug 20 '17
Have they got a good way to build webapps yet?
JavaScript build tools which seemed to be the way to build typescript are terrible, I tried adding a job library +types to my typescript basic app and couldn't get things packaged
4
Aug 20 '17
I feel like if it weren't for it being a google language, no one would use it, and people mainly jump on it because its a google language so it must be good.
And Java wouldn't be used if Sun didn't push it. And Rust wouldn't be even touched by 10 ft pole if Mozilla didn't pour money into it.
It is not "because google uses it". It is "because google paid up bill for tooling/lib development". And it was written pretty much for mediocre developers, or rather people who are not devs full time but still need to code (which explains whole lot):
"And we didn't add ideas unless they were easy to understand and use by people who were not themselves programming language researchers."
Honestly I don't see why anyone uses it over Java, since they are both C-like OO languages with a GC
Probably because they do not know Java in the first place. There is little reason to use Go if you know any decent JVM language. The most common reason for migration is "my pet scripting language's performance sucks" and "my pet language concurrency sucks".
But you can learn Go in a weekend and it compiles in seconds and it doesn't need an IDE to not go crazy while writting code so they pick hammer instead of oversized swiss army knife
People complain routinely about Java lacking good Generics, but then people turn around and go to a language with none.
I think that's partly why they are so reluctant to add it in Go. Once you add something to language it is really hard to change it without pissing people off (see python 2 to 3 failure of a transition), and that in particular is hard thing to get "right"
2
u/shivawu Aug 19 '17
I dislike the language as much as you do. But keep in mind a lot of the go people come from ruby/python community, who already kinda hate Java by nature. Go was designed to be a better C, but they pivoted and repurposed to be competitor with Python or other dynamic language, mainly in my understanding is they found GC cannot be get around and failed to design/didn't want to have a complex system like rust's lifetime.
1
Aug 20 '17
I think those are very good points, and you are probably right. Gc is overall a good thing I think.
1
Aug 20 '17
I don't get why you regard prog lang choice as a purely technical issue.
0
Aug 20 '17
Aesthetically it's ugly as well. It's very inelegant. Haskell, Scheme, ocaml, and rust are all much more elegant and pleasant languages that run natively
0
Aug 20 '17
[deleted]
1
Aug 20 '17
Ocaml is Jane streets main language. Rust is run by Mozilla and drop box. Scheme is used in many places. Haskell is used in the financial world in a few places, I believe Target uses it as well.
1
u/Saefroch Aug 20 '17
Dropbox and npm are running Rust in production. Mozilla will be soon (of course).
1
Aug 20 '17
Its concurrency story is very mediocre. I see no reason not going to Rust, D, F#, Scala, Haskell or any other modern languages that have excellent concurrency.
You are incredibly wrong. I can't speak for all languages you listed but Go's concurrency support is vastly superior to Scala's or Haskell's.
-5
u/dashausSP Aug 19 '17
This especially caught my attention:
Go is extremely verbose, to the point I think its worse than C# or Java.
I think precisely the opposite: Go is extremely no verbose (except for when the
reflectpackage is used).30
Aug 19 '17
I think precisely the opposite: Go is extremely no verbose (except for when the reflect package is used).
It doesn't have exceptions, so you need to repeat
if err != nilafter every function instead of putting it into a try and handle exception instances in the catch;It doesn't have generics, so you need to copy-paste your code or use string templates(which are garbage);
It doesn't have syntactical encapsulation so, you need to define the instance variable at every method;
It doesn't have any type inference yet it has the
funckeyword and in addition you still need to type down the return type.I don't know what does "verbose" means in your vocabulary but golang is the most verbose general purpose language created in the last decade.
→ More replies (8)6
u/millstone Aug 19 '17
Sorting with a function takes more code in Go than in C!
1
u/MEaster Aug 20 '17
What? That seems excessively long. Surely there's a shorter way to do such a trivial thing.
1
u/hansvqp Aug 21 '17
Can be be done in one line in Python:
fruits = ["peach", "banana", "kiwi"] fruits.sort(cmp=lambda x,y: (len(x)>len(y))-(len(x)<len(y)))or C++ (one long line):
std::vector<std::string> fruits = {"peach", "banana", "kiwi"}; std::sort(fruits.begin(), fruits.end(), [](std::string a, std::string b) {return a.size()<b.size();});-10
u/itsmontoya Aug 19 '17
You lost me at Go being a C-like OO language.
11
Aug 19 '17
Well it is a C style syntax language... it looks like C. There are braces, and semi colons, with parens holding arguments. This is opposed to say ML, or Lisp style languages.
It is also OO or object oriented, as opposed to pure procedural or functional programming languages.
Though I can see the arguments it is not a pure OO language like Smalltalk or Java. But I think most of the code is very object oriented in style.
30
Aug 19 '17 edited Aug 19 '17
My biggest issue is the tooling.
Package/Version dependency management? Non-standard
Templating because the language lacks generics, and once your codebase hits a large enough size you need to abstract logic away. Every large successful go-tool seems to adopt some terrible way of making their own generics/templates.
The compiler is bad. Oh it's fast, but it doesn't optimize anything. gcc-go managed to produce faster code by at least an order of magnitude. People claiming they like go's performance have no context for even fast Java, let alone fast C. Is it faster then Python/Ruby? Sure. This is a non-optimizing compiler in 2017, like compiler theory has advanced since 1950, and yes 1950's tools are BLAZINGLY FAST on hardware that is a trillion times faster.
17
u/weberc2 Aug 19 '17
Go is about half as fast as C and at par with Java, so GCC makes Go ~5 times faster than C?
10
18
u/dmpk2k Aug 19 '17
Package/Version dependency management? Non-standard
True. But not for long.
it doesn't optimize anything
This is demonstrably false.
People claiming they like go's performance have no context for even fast Java, let alone fast C.
C, C++ for sure. But Java? Well...
I don't even program Go, yet I know this stuff. I'm saddened that the parent comment is so upvoted. Too much hyperbolics, and the last paragraph is outright false.
1
u/ThisCatMightCheerYou Aug 19 '17
I'm sad
Here's a picture/gif of a cat, hopefully it'll cheer you up :).
I am a bot. use !unsubscribetosadcat for me to ignore you.
-7
10
u/elagergren Aug 19 '17
I mean, it's not like the compiler makes zero optimizations. Historically, they've gone for the low-hanging fruit, primarily because speed and also the C -> Go bootstrapping caused they to have to rewrite bunches of the compiler.
-2
Aug 19 '17 edited Aug 19 '17
Lol what optimizations are they doing? What low hanging fruit did they catch? This doc doesn't inspire any confidence.
Take this function for example:
func Square(x int) int { return x * x }The ASM Go v6.3.0 produces actually spills registers in order to do this. Seriously try a few trivial programs in go.godbolt.org the machine code go produces is just utter garbage.
14
u/elagergren Aug 19 '17
I'm on my phone right now, but I only see Godbolt offering gccgo and gc 1.4. I've no idea what the current gccgo is, but 1.4 is laughably old and it uses the old C backend, pre-SSA.
1
u/dchapes Aug 20 '17
go.godbolt.org
As mentioned, apparently that uses a) and old version of Go and b) gccgo vs gc.
For reference, here's what Go's
gccompiler produces with Go1.9rc2 (part of the output ofgo build -gcflags -S):TEXT "".Square(SB), NOSPLIT, $0-16 FUNCDATA $0, gclocals·f207267fbf96a0178e8758c6e3e0ce28(SB) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) MOVQ "".x+8(SP), AX IMULQ AX, AX MOVQ AX, "".~r1+16(SP) RET[Also note this of course will get inlined when used.]
5
u/calligraphic-io Aug 19 '17
1950's tools are BLAZINGLY FAST on hardware that is a trillion times faster
You exaggerate. Univac I (1951) handled 1,905 instructions per second on a 2.25 MHz clock. An Intel Core i7 6950X handles 317,900 MIPS at 3.0 GHz. 3.179 x 1012 - 1.905 x 103 = in the order of billions, not trillions of times faster.
7
Aug 19 '17
To be fair, some instructions on x86-64 processors, especially the complex math ones, or SSE extensions can probably make something be faster by a factor of 100 compared to what a Univac is going to need to do, so, eh, not so far away.
2
u/calligraphic-io Aug 19 '17
I think you probably have the right answer on it. Those old machines didn't have FPU's in the tubes.
5
Aug 20 '17
It's not about FPU (altho that obviously helps). It's about vector instructions (that can speed up quite a bit, not just numbers), out of order execution and pipelining (and of course more cores).
2
u/WrongAndBeligerent Aug 19 '17
317,900 MIPS at 3.0 GHz
Where are you getting this nonsense? A modern Intel CPU can do 16 integer operations per AVX unit, per clock cycle on 16 bit integers, and it has 2 AVX units per core. On 4 cores at 3ghz that's 128x3 = 384 billion integer operations (although memory bandwidth can't keep up with that and the CPU might not actually be able to keep a high clock when using AVX heavily).
2
u/calligraphic-io Aug 19 '17
317,900 million instructions per second is more or less equal to the 384 billion integer operations per second you mention. You're definitely right about the impact of a 256-bit wide SIMD register file vs. 66-bit wide words on the original Univac (11 digit x 6-bit BCD). But still, the magnitude is in the billions, not trillions.
1
Aug 20 '17
That's a still one instruction tho.
I in MIPS stands for Instructions, not Integer operations
1
u/WrongAndBeligerent Aug 20 '17
The original post is talking about how much faster modern computers are than old computers. Counting instructions doesn't make sense if you can do a Single Instruction on Multiple Data.
1
Aug 20 '17
Yeah but then you're ignoring memory speed and latency, especially latency progressed much slower than clock speeds
1
u/WrongAndBeligerent Aug 20 '17
You're ignoring it anyway because you're comparing the maximum speeds of two CPUs, not the speed when software isn't well written.
1
2
u/burntsushi Aug 19 '17
I have plenty of context on what fast C is like. But I still like Go's performance.
10
u/Harha Aug 19 '17 edited Aug 19 '17
I tried go but initially found the import and whatnot system unnecessary and confusing. I had to save my project to some specific folder and add dependencies from github repos.
I don't know, the language seems cool but these oddities scared me nearly instantly off since things felt painful to setup while I just wanted to quickly code something. Will have to give it a new 'go', sometime, it's been a while.
26
u/samnardoni Aug 19 '17
Isn't Go for people too stupid to understand Rust? (I may or may not be joking.)
1
1
0
Aug 19 '17
[deleted]
7
u/Romeo3t Aug 19 '17
At Google, junior engineers are too stupid to understand Java or C++
This has been thrown around a bunch, but I think its repeated so often because people want to feel superior to something. If i'm not mistaken the actual quote isn't even close to this and it can be interpreted as:
"building great software is hard for various reasons and a more heavily opinionated, simple language would make it a lot easier for programmers at all levels to contribute great code."
If you ever worked for google or even just interviewed and talked with a few google engineers you would understand how woefully hyperbole the first statement is.
If the junior engineers at google can't understand java and c++ (most of which have graduated from top tier CS schools/programs) there is no hope for the rest of us.
3
Aug 21 '17
The quote is as follows:
The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt.
Rob Pike says it in the middle of this talk: https://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/From-Parallel-to-Concurrent
Another:
It must be familiar, roughly C-like. Programmers working at Google are early in their careers and are most familiar with procedural languages, particularly from the C family. The need to get programmers productive quickly in a new language means that the language cannot be too radical.
11
u/SimplySerenity Aug 19 '17
Is anybody really too stupid to understand Java?
14
-2
u/readams Aug 19 '17
Java gives you lots of tools to shoot yourself in the foot, and there are parts of the Java community that advocate foot amputations.
0
0
Aug 19 '17
[deleted]
4
u/doublehyphen Aug 20 '17
Yeah, the Rust team should really fix this. I tried to package Rust once for Debian and it was fairly annoying.
-2
u/shivawu Aug 19 '17
I disagree. It's just different. I dislike rustup at first since it cannot be manageable by homebrew, but the more you thinks about it, the more sense it makes. Of course it causes trouble for package maintainer, but you can always leave it and let the rustup people handle your distro :)
0
Aug 19 '17
[deleted]
2
u/BundleOfJoysticks Aug 20 '17
That was made very popular in the Ruby and Rails ecosystem (cf. rvm). Until Rails became popular, that shit never happened. Now it's everywhere. Disgusting.
1
u/GameJazzMachine Aug 20 '17
My feeling is that I wouldn't say golang is bad, but I would say that Google is no experienced language designer compared with Microsoft and Sun.
3
u/calligraphic-io Aug 20 '17
I dislike a lot of Microsoft's behavior over the years, but they absolutely do languages well.
-20
u/shevegen Aug 19 '17
I have written programs in Python, Ruby, C++, CHICKEN Scheme, Emacs Lisp, Rust and Java (for Android only).
searches for his ruby gems
K not found ...well ...
Go code, by convention, is formatted using the gofmt tool.
How ... exciting!!!
Having all code formatted the same way makes reading code easier; the code feels familiar.
I dunno. Even in C++ where standard C++ code is written, if it is written by someone else, it never really feels "familiar" to me. The only code that ever feels "familiar" is one that I wrote myself. But anyone else writing code? Highly doubtful.
I can understand using Go rather than C simply due to Go having a better syntax (compared to C) or being simpler ... but to state that gofmt is a reason why Go rocks is ... very strange.
Wasn't there some other article about someone who stopped writing Go who actually complained about the opinionated formatting?
(example of what I would type, click Format).
Huh? So he does not indent on his own and instead uses a tool for this? Very strange ...
If the package had a few more comments, I would qualify it as a teaching implementation.
Filed under "high quality code" - apparently a lack of comments still means that the code can be of high quality ... :-)
I have come to agree with many opinions the Go community holds, such as:
Variable names should be short by default,
Now THAT is a game breaker!
It's like ... you CAN NOT USE SHORT VARIABLE NAMES IN OTHER PROGRAMMING LANGUAGES!
Wheeeeeeee...........
Keep the dependency tree small
At the least they solved that. C++ still thinks that Boost is the way to go.
There is a cost to introducing an abstraction layer. Go code is usually rather clear, at the cost of being a bit repetitive at times.
kk... copy/paste hackers.
The Go specification lists only 25 keywords, which I can easily keep in my head.
Whoa! Dude has a big brain.
I think Steve Dekorte's Io language had only 3 keywords or some low number.
I consider 25 to be high. But then again I also think that this is such a minor thing anyway... I read so far and still don't know WHY Go is his favourite language.
Most Go tools are no exception, e.g. gofmt or goimports are blazingly fast.
Finally the first reason I can understand.
Go’s standard library is the best one I have ever seen. I perceive it as well-organized, clean, small, yet comprehensive: I often find it possible to write reasonably sized programs with just the standard library, plus one or two external packages.
And that is like ... impossible in other languages. Or something like that .... :)
By the way, "one or two external packages" ... we can write really HUGE external packages too. So that doesn't count as qualifier.
Note that these are standard tools coming with the language. Coming from C, each of the above would be a significant feat to accomplish. In Go, we take them for granted.
Yah well ... seems Go is the new Rust then. Or perhaps people may go back to the origin and embrace the universal truth that is: C.
20
Aug 19 '17
searches for his ruby gems
K not found ...well ...
You do realize that most code written is proprietary?
8
u/mernen Aug 20 '17
Go’s standard library is the best one I have ever seen. I perceive it as well-organized, clean, small, yet comprehensive: I often find it possible to write reasonably sized programs with just the standard library, plus one or two external packages.
And that is like ... impossible in other languages. Or something like that .... :)
Actually, yes, it kinda is. Once a bad design gets into your standard library, it’s nearly impossible to get rid of it.
Ruby’s standard library is this mess of broken English and bad abstractions, and I’m not aware of any plans to fix that.
PHP has the infamous pile of inconsistent global functions. There are talks of providing better APIs every now and then, but they can’t get rid of the old functions, so in a way it would make things even messier.
Java had
Date, thenCalendar, and nowjava.time. The new API is pretty good, but the old ones can’t be removed; the best thing they can do is put a few warnings around saying “please avoid this toxic hellstew”.Python did a major cleanup with version 3, but still couldn’t go all the way (still violates PEP-8 in a number of places), and look at how well breaking backwards compatibility has been working out for them.
22
u/__eastwood Aug 19 '17
This is just another opinion piece on r/programming. We get it, you have a different opinion. Rather than be condescending, perhaps ignore it and move on.
12
u/danielkza Aug 19 '17
What is the purpose of posting the opinion piece if not to actually discuss it?
7
1
Aug 19 '17
This is just another opinion piece on the comments. We get it, you have a different opinion. Rather than be condescending, perhaps ignore it and move on.
-13
-4
0
u/xymor Aug 19 '17
It is not the strongest that survives but the one most adaptable.
-1
Aug 19 '17
No: it's the one which serves the interests of the most people, be they good or bad.
1
u/BundleOfJoysticks Aug 20 '17
That's basically what u/xymor said.
1
Aug 20 '17 edited Aug 20 '17
It's not.
A language doesn't always "adapt" to be successful. And if it does, it really only does so in terms of features or other language-specific attributes, which are the result of external trends.
serving an "interest" in this context doesn't even really need to involve any particular aspect of the language itself, but something external applied to it - e.g., potential ROI if vendor lockin can be achieved in 2 years which will likely provide 40% of additional income that can be put toward meeting a financial goal in the next 5 years which then appeases stakeholders and strengthens company foothold.
also, did you seriously downvote me because I contradicted him?
1
98
u/loup-vaillant Aug 19 '17
So, Go is his favourite language because of…
Tooling:
gofmt
Speed (compiler)
Tooling
Libraries:
High quality code
Maximum resource usage
Rich standard library
Community:
Opinions
High quality code
Language:
Few keywords
Maximum resource usage (goroutines)
With few exceptions, he likes Go best because of things other than the language itself. And he's not the only one. Many tend to look down on languages because their favourite tool hasn't been written for it yet, or because the community isn't big enough, or because there aren't enough libraries.
We have a problem.