145 points · by wardn · 7y ago · 85 comments
When you need a decent concurrency story, moderate speed, and have a problem that is concrete, choose Go. It’s a good candidate for replacing Python, Ruby, JavaScript, and smaller Java projects.
Rust is better if you need maximum performance, are building a large project where more abstraction where parametric polymorphism can help, or need thread safety. It’s a replacement for larger Java projects, C++, and C.
Generally I write more Go projects, but my Rust projects tend to be bigger and are doing very complex things like user space networking or wringing maximum performance out of a kernel subsystem or running in a very low resource environment.
Both languages have made my teams enjoy their work more. We also have empirically measured a decrease in time spent fixing bugs and other production issues, as well as reduced resource consumption (mostly from getting rid of Python for Go) and snappier cli tools that are saving us $$$$$$ in terms of time and hardware). Both languages are built for modern problems and getting stuff done.
Also Go and Rust position us to hit Wasm hard. I can’t understate how important Wasm support is and how both of these languages are already miles ahead of the competition. This is containers right before Docker. Your company should be pivoting or have a strategy to get on deck with these languages.
That’s a bold blanket statement. Besides the fact that I would die inside a little if I had to use Go every day of my life, Go is in no position to replace any of the aforementioned languages (Python, Js, Ruby, C++), let alone all of them, not by a mile.
Go also favors libraries over frameworks and is super thoughtful about using too many untested dependancies which means we don’t get stuck in frameworks that become legacy (rails) or use stuff that has security holes or that will change out from under us (npm).
The Go standard library doesn't come close to replicating the functionality of Rails, let alone the gem ecosystem of Ruby/Rails. If you don't need it, great! Otherwise, you're spending time re-implementing what already exists and probably doing a worse job of it.
Go doesn't have a proper, complete type system. This means entire classes of preventable bugs are not prevented by the compiler. Yeah, its fast, but you can pass in null instead of object references and the compiler won't even bat an eye. Not to mention the extremely verbose error handling and the lack of abstractions all around (no sum types, no iterators, no array filter/map, etc) despite being more "high-level" than Rust in layman terms.
This is nonsense. There's no definition or checklist that defines what a complete type system is. In that vein, Haskell doesn't have a proper type system because it lacks dependent types, and a bunch of other features that are only available through language extensions.
We are still not at a place yet where the from first principles, type driven approach is going to always be the right choice over the hack out code approach. Rust simply takes more investment to learn, and more time to master, and while I agree that investment pays off 1000x, and that Java and C++ should stop existing, Go is a better fit for the people who just want a productive, reasonably efficient language that can get stuff done. Having a very simple hammer like Go that limits what people can do and sticks to what people already know is useful and beneficial.
The Go programming language and the compiler have too many soundness holes, therefore I call the type system incomplete. When you can pass in a null literal in place of an object and the compiler doesn't stop you, it goes against any common sense. Not to mention the pervasive use of reflection (interface{}) due to lack of generics.
Allowing null pointers to exist in a new programming language is a decision to ignore decades of progress in pl theory and type system research. It makes sense for google knowing the motivation behind Go, but telling people to avoid Rust unless they need polymorphism or performance is disingenuous at best.
> We are still not at a place yet where the from first principles, type driven approach is going to always be the right choice over the hack out code approach.
Why not?
Why do people pushing those claims think a go program compiled down to native executable is slower then rust Is it the rust compiler is better ? Is the go stdlib slower ? Is it the gc
The GC is going to add some overhead is it that bad for most uses except for real time critical large s/w
- The Rust compiler uses the LLVM backend, which is generally more aggressive about optimizations and code generation. The Go compiler is a custom compiler (I think plan 9 inherited) and as of fairly recently didn't do some optimizations that are fairly common otherwise (non-leaf inlining).
- Rust as a language heavily favors automatic (stack) allocation, and does not favor complex object graphs, so that will often help make algorithms more cache-friendly. In go, stack allocation is strictly an optimization. This is somewhat defeated by the common use of 'smart' pointer types.
- Due to using segmented stacks, the function prologue/epilogue is a bit more involved in go, than it is in a language like rust.
So with rust, it is - with some work - possible to have code that executes as the equivalent C code would. I guess in go you could too, but it'd be quite a bit harder, and go against the grain of the language.
Compared to the performance of a typical interpreted dynamic language, this is a fairly marginal difference however.
Yes, there's can be benefit to starting from scratch with a different language w.r.t. training new teams with good habits and skills from the start.
But going into Rust just because it's fashionable at the moment is a recipe for pain several years down the line.
If you want a working pain-free solution learn C++17 instead.
C++ 17 is still a mess. You still lack a proper package manager, type constraints, modules, sane lookup rules for function calls, thread safety, a proper monastic future type, I could go on.
Also most people won’t see C++ 17 or 14 for another decade. Even if the language decides to start bolting on more features the ecosystem is still very slow.
No, it is not.
> proper package manager, modules
That's an OS usability issue, not a language problem. Personally, Nix solved this for me.
> type constraints
C++ has type constraints, and ones that actually work. I suspect what you call 'type constraints' is something that can't exist if you understand the difference between 'run-time' and 'compile-time'.
> sane lookup rules for function calls
A very minor issue. If you don't like function overloads, then don't use them.
> thread safety, a proper monastic future type
Please no. The kind of 'thread safety' you want destroys the benefit of using threads in the first place. C++ threading is perfect as it is.
> Also most people won’t see C++ 17 or 14 for another decade.
Frankly, I don't care about these twisted people stuck in enterprise hell.
A solution to what, exactly? I'll admit I haven't worked with C++ in awhile, but I'm skeptical of C++AnyYear being "pain-free". What do you like in C++17 that you feel is lacking in Rust?
Coming from Java, I find that I don't miss generics and exceptions as much anymore as I thought I would :)
Rust is not a simple language by any means -- it's a great replacement for C++, but I'd be pretty surprised if it displaced the popular general purpose languages (which Go has actually managed to do.)
Still plain old Java, .NET and C++ as always.
They are today's NoSQL.
FYI I'm language agnostic, but I'd like to see c++ eventually replaced. .NET is currently looking good, and I'm ambivalent on Java, but I think there are valid reasons to be looking at go right now,if not rust. They both seem to be tuned to modern hardware design despite the hype.
Unity is increasing C# popularity, though. So maybe .NET is not going away, at least yet.
It maybe won't go away, but I think it lost a lot of relevance.
https://www.c-sharpcorner.com/forums/how-many-c-sharp-develo... (2014)
It doesn't really say much given the selection bias.
Say a person said they're mostly writing finance software and Go isn't a language they'd prefer to use for their next project. Those two data points on their own also don't tell much - but if multiple people answer with that combination the Go team knows that they aren't covering the needs of the finance sector appropriately. With that knowledge they can e.g. request more information from those people and start working to fix those issues.
Go works very well in domains with a well-defined and limited set of entities.
What causes OOP to be well suited for finance's use case?
What are the short-comings of structs/interface methods that Go! provides in the financial space?
If Go! had generics, would that change it's suitability for finance?
I would think that first-class concurrency would be useful in that space, is it?
Java/net are just not fun and the mentality of the developers seems off-putting to a lot of new devs and those seeking to move fast and ship stable.
This is true for anything where Go is underused or not used and the bias here still stands, since those people are very unlikely to be represented in the survey.
I wish the package situation for Go was better for SublimeText. Currently most of the worthwhile golang packages that add vet, goimports, fmt, etc support are either abandoned or buggy. Margo bailed on using Package Control so it's difficult to install, not to mention buggy.
I've used VSCode for a while but it chokes sometimes and you can't beat the speed, ease, and power of SublimeText.
I just maintain my own on-save hooks, build systems and plugins to integrate various quality-of-life Go tools. With the benefit of being able to tailor any such functionality to exactly the way you like to work and nothing more, it's far less effort than it would be to create the all-singing-all-dancing comprehensive package that is absent.
As a system guy, I am also happy to follow two OS projects in these two:
[1] https://github.com/mit-pdos/biscuit [2] https://github.com/redox-os/redox