Rust IMO is much more advanced and expressive. It's a joy to write, makes you think and feel like a developer rather than an assembler that you can feel with Go. IMO it handles most of the common problems with languages well and has probably the best support for Web Assembly if that's your goal. It's not garbage collected, which is critical for systems programming. It is more complex than Go though and takes longer to master. Also, while it's growing rapidly, Rust also has fewer job openings compared to Go, if you're doing this for getting a job.
> Rust IMO is much more advanced and expressive. It's a joy to write
It can be argued that in a professional setting, this isn't what a business cares about. Businesses care about getting stuff done, not whether you like to write your code and your language is "expressive". They want boring. Boring is good.
Have you actually experienced this to be a problem in the last half decade with Go? GC pauses in modern Go programs are short enough to be negligible in almost any practical program.
Maybe, but is it also a joy to read?
For example, I find it very hard to figure out what the type of public_dependencies is in this declaration: https://github.com/rust-lang/cargo/blob/8fbc8459d59f3acecdb6...
This is the same kind of thing that makes JavaScript challenging to read. It requires a lot of discipline on the author’s part to make it clear what is going on, and even the best of us lack discipline at scale.
/// A map from packages to a set of their public dependencies
public_dependencies: HashMap<PackageId, HashSet<PackageId>>,
I do agree with you that Rust is easier to read in an IDE though, since then those types gets autoresolved and hinted inline for you.> limited language features
That is by design and I like that. I was a C# developer and seem how C# has evolved, I'm glad that go keeps it simple.
> Lack of docs, broken and confusing functionality
Docs for me are just fine, never had a problem. Could you give an exemple of "broken and confusing functionality"? I really like the cli ux and the its std lib, it is really complete from my point of view, so I'm curious to hear from someone with another point of view.
The syntax rules and the reference spec of the language is very concise too.
There is an issue to make it easier[1], and doesn't seem too hard to find more information about it[2].
More general: I think I've seen every language described as "badly documented" at this point. Someone new comes to the language, knows what they want to do, gets stuck/frustrated because it's a little bit outside the "mainstream path", and calls it "badly documented".
For me it's a language I always wanted to have: essentially C with a GC, small enough you can carry it in your head with most of the footguns removed.
I honestly also have no idea why Rust always makes an appearance in a Go thread, I can't think of two languages with such a diametrically opposite learning complexity.
> I honestly also have no idea why Rust always makes an appearance in a Go thread
Both Rust and Go people are very vocal about their languages.
Ok, I get it that there are developers that can't live with languages that don't have tons of shiny features to play with, but please don't disparage the others as "inexperienced"! If you have ever gone back to some "expressive" code you wrote months/years ago while feeling very productive and were left wondering "WTF was I thinking when I wrote that? Can someone explain it to me?", then you start to understand the reasoning behind Go's simplicity.
Also, I'm not "disparaging" anyone here. Please read it again and notice that I was simply saying that golang is good if you are inexperienced. That does not mean that every golang dev is inexperienced. If you interpreted my post in that way, I think you should probably ask yourself why that is.
> Which is good if you are inexperienced, but not so great once you grow and try to become more productive. A more expressive language is a must then or you'll be stuck.
which implies that people who use Go have not grown and become as productive as people that use more expressive languages (because such languages are a "must" to grow in this way). At the very least, you are obviously disparaging Go programmers' productivity.
That's not what it says, or at least not what I meant.
People are different and can accept a different amounts of repetitive work. Heck, there are even people who really like it and want to think as little as possible. So all I'm saying is that there exist people in Go that grow and then want to improve their productivity but are now restricted by the language.
And I think I have a point in the sense that Go is already adapting to those people by e.g. adding generics. So the number of those people can't be that small, otherwise I don't think they would follow their requests.
> because such languages are a "must" to grow in this way
And yeah, there are of course different ways to become more productive, e.g. through other kind of tooling, better organization etc. But the language is definitely one of our most important tools so if the language limits you then switching it is the only way to improve in this regards.
In fact, English is not my native language and I often feel limited in both my mother tongue and English. Sometimes I'd love to just mix the two but obviously I can't. It's the same thing, but natural languages are much closer to each in terms of expressivenes than programming languages are.
> At the very least, you are obviously disparaging Go programmers' productivity.
I'm saying that a developer who feels limited by golang can and will become more productive with a less restrictive language, all other things being equal(!).
For golang there's certainly devs how just don't mind a certain amount of repetitive work and are happy to use Go until retirement. And I don't think that's a problem at all. People are different and I think we should embrace that. If you think being called a "factory worker" is not flattering, then that's more your personal judgement than me being objectively disregarding factory workers.
Again: Try to read my response in the right context. I'm explaining why some people dislike (or even hate) the language. It was a response. Please try to keep that in mind when you reply.
I've never been "stuck" with Go in the sense that I wasn't able to do something I wanted.
I've programmed in plenty of more expressive languages over the years, and I don't think there's much difference in terms of productivity. Sure, some more expressive languages allow you to do something very quickly and concisely, but it also increases cognitive load when writing and reading and in the end it seems to balances out. Sometimes I do find myself thinking "gosh, I wish I had $feature_x from $language_y" at times, but I have that with every language.
It's a "dumb" languages in that sense, I guess. Which is also why it's nice: you don't have to focus on the mechanics of what you're implementing, you just implement what you want, as per the "Zen of Python"; "There should be one – and preferably only one – obvious way to do it."
Are… you sure? Go has some of the best documentation. You can learn Go in one sitting with its tutorial. Not exactly sure I agree with you there.
> limited language features
This is where people lose me.
You are painting with a pretty broad brush, can you provide a concrete example of these?
if (cond) {
return x
} else {
return y
}
works, but if (cond) { return x }
else { return y }
doesn't.So your example gets transformed to:
if (cond) { return x };
else { return y };
So it is mentioned in the language specification, just as a non-obvious consequence of this.It's not my most favourite part of the language either, but at least the compiler message on it is better now (it used to complain about semicolons, which was confusing because they're not there in your source code; now it just says "unexpected else, expecting }", which is still a bit confusing but better).
I'm fairly sure The Go Programming Language book mentions this somewhere near the beginning, but some of the online tutorial/tour perhaps could be improved. There's always a bit of a balance in how much to mention.
hmm, what's this then?
You'd think one would want to look for it in that instead of an FAQ page.
The section you linked does explain it, btw.
IfStmt = "if" [ SimpleStmt ";" ] Expression Block [ "else" ( IfStmt | Block ) ] .
Note there is no newline or semicolon between Block and the optional “else” clause, and a Block is thusly defined: Block = "{" StatementList "}" .
So that being the case I’m not sure why you’d assume it’s valid to put a newline after the trailing “}” of the Block, before the “else”.The other factor at play here is the treatment of semicolons: https://go.dev/ref/spec#Semicolons
All of this is quite natural once you use the language. in fact, it was designed this way in response to the way it was being used.
It is not appropriate for the spec to constantly reiterate concepts that have already been introduced, but rather it should precisely define each concept once. If you want to learn a language from its spec then it behooves you to consider the document as a whole. That requires a lot of mental overhead and I think most people are better off learning from examples and tutorials rather than reading a language spec.