Rust vs Go

what are the advantages of each? which is better?

Other urls found in this thread:

tour.golang.org
m4rw3r.github.io/rust-questionmark-operator
devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/
goinggo.net/2014/06/pitfalls-with-closures-in-go.html
soryy.com/blog/2014/common-mistakes-with-go-lang/
jozefg.bitbucket.org/posts/2013-08-23-leaving-go.html
kaushalsubedi.com/blog/2015/11/10/golang-sucks-heres-why/
nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/
youtube.com/watch?v=KINIAgRpkDA
twitter.com/AnonBabble

Question out of curiosity: Is there anyone looking to hire someone with skills in one of those programming languages?

google, probably. In general, though, companies want to hire someone with proficiency in one or more languages, regardless of what they are. After learning a couple languages to a high level, you can learn another one in a relatively short period of time.

Go is good at network and concurrent programming Rust is good for pretty much everything else, especially systems programming.

Lots of people are hiring Go devs because it's one of the best languages to build web site backends with.

Basically this. Rust is *also* good for network programs, and it's by no means bad at concurrency, but it doesn't make things as stupidly easy as Go does.

Personally I kinda hate Go but I plan to use it on my next networking-related project, because it offers the best return on my time investment in that context.

Why do people keep bringing up Rust vs Go comparisons? Rust is aimed at a vastly different purpose than Go, so it makes little sense to compare them.

They are both
>systems languages
>designed to replace C/C++
>new
>popular with SJWs
>similar syntax (type after variable)
>"lambdas" (functions)
>made by internet companies

use either if you are a webscale 10x rockstar developer

I wouldn't really call Go a "Systems Language".

they both suck because they aren't D

They definitely have different audiences. Rust is fast and system level. Go fits between system and script.
Because UI frameworks are putting more emphasis on the front-end, a lot of web back-end code has turned into simpler API calls. This is where Go fits best, which I think makes it closer to the scripty languages companies are replacing. Another new language worth checking out in this category is Elixir.

Ada's better than rust in every possible way. So try go out of the two.

start here: tour.golang.org

www.golangprojects.com

>suggesting a garbage collected language when people are talking about system programming languages

unwrap unwrap unwrap
unwrap unwrap
unwrap unwrap unwrap unwrap!

Eh, If you're writing unwrap-stew in Rust you probably should step back an consider handling failures better.

What is operator? ?

You don't even know go and yet you are posting...

>operator?
reading this: m4rw3r.github.io/rust-questionmark-operator and I just can't stop laughing.

And they even said C++ was complex.

No thanks Rust, I'd rather dealing with Crystal and its GC.

>And they even said C++ was complex.
It's just a convenience macro. If you want to just unpack Results using a match black you still can.

>convenience macro

debugging will be fun.

Either way, I hope every one will start using this meme language more, so 10 years later I can laugh at all of those idiots complaining "it's hard to do simple things", "it changes too much it's a maintaining nightmare", "fuck toml who thought it was a great idea", etc.

Both are shit.


>Rust

Hey, let's make a language with a bugzillion features and a horrible syntax that makes C/C++ look well structured and clean languages.


>Go

Hey, let's makes a langauge that looks easy as fuck, but is full of pitfulls the further you get..

"What, you thought you could use a channel like THAT? No, silly.. "

>devs.cloudimmunity.com/gotchas-and-common-mistakes-in-go-golang/
>goinggo.net/2014/06/pitfalls-with-closures-in-go.html
>soryy.com/blog/2014/common-mistakes-with-go-lang/
>jozefg.bitbucket.org/posts/2013-08-23-leaving-go.html
>kaushalsubedi.com/blog/2015/11/10/golang-sucks-heres-why/
>nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/

Don't listen to this guy OP he's an idiot.

I'll try to be objective. But I'm biased to Rust so I'll state that. I started my career out doing embedded realtime C. I'm going to ignore community politics also, just stick to technical crap.

>Go Pro's
-Fast compile times.
-Simple language, you can learn 80% of it in a weekend or so.
-Very simple powerful built in concurrency.
-Relatively fast compared to Python/Ruby.
-Static compiles so you don't need to worry about libs/deps when you deploy.
-One code format makes reading deps source code/other peoples' code simple.

>Go Con's
-Packaging/Project system sucks
-Compiler does a lot of *magic* for you under the hood related to concurrency makes it pretty hard to reason about what ASM is generated for what code you write.
-Error handling system is flaming hot garbage.
-Garbage Collection.
-FFI links against C code are INCREDIBLY slow.
-Extremely simple language writing anything useful takes a lot of boiler plate.
-The compiler sucks. Lacks a lot of modern optimizations.

>Go Prognosis:
It is a language that is designed more or less to supplant server side Java. When you code in Go-Lang you don't think about the Processor/OS/Memory you have. You think about Go-Lang. Want to spawn over 9000 threads, but not have you quad core lock up? Go has your back.

Go is not a proper C or C++ replacement. It is a Java or Python replacement.

Go is really just a pet project of a bunch of old Bell Labs folks playing with fun ideas for compilers/assemblers they've had 20 years ago. Don't believe watch this talk on the Go-Assembler youtube.com/watch?v=KINIAgRpkDA

Yeah it is cool you can build an assembler with nothing but sed (from the author of sed), and handle porting to a new arch with nothing but a lex file. But this doesn't generate good fast ASM. It generates simple, slow, bullshit ASM.

Gow is Garbaje collection a con? I was told its an advantage to have this

>rust fanboi

Okay now Rust.

>Rust Pro's
-Low level, simple to reason about ASM generated from code once you see past the 10 miles of Compiler BS and realize it is just C with a ML type system.
-Very fast code on par C/C++
-LLVM is a solid backend, great code gen
-Porting between Linux/MacOS/Windows and ARM/x86/x64 is dead simple if you stay in safe code land.
-Package/Project management is great.
-Builtin memory safety is awesome, many much strong guarantees then C/C++
-No exceptions/stack unwinding.
-Macro system really cuts down on boilerplate, and is hygienic.
-FFI links to C are no different then links to Rust
-Error messages are pretty clear, and offer suggestions to fix code.
-High level functional programming is pretty simple and really fast.
-No Aspect Oriented Overriding Virtual Inherited OOP brain damage.
-Writing unit tests is really simple.

>Rust Con's
-The learning curve is a fucking brick wall
-Borrow checker will really get on your nerves as you start to learn the language.
-Macro error message are as bad as C++ template error messages.
-SIMD isn't stable
-Inline ASM isn't stable
-No guaranteed structure layout, aligning fields on u8/u16/u32/u64 boundry is impossible unless you do it by hand with #[repr(c)] and then it'll still be platform specific.


>Rust Prognosis:
It wants to replace C not C++. It is still 10-15 years away from wide spread industry adoption. The platform is very immature, and this shows. It is a good language to write low level systems code, like a networking stack, drivers, system daemons, game engines, and server applications. The stuff people use C/C++ for.

Lastly the community is un-apologetically politically leftists and this is a real issue from people who mix politics and technical rigor.

It's a con because you can't know how long or when the program will pause to clean up memory. In some applications this matters (because you can't have your video game pause for 2 frames to clean up memory) but in the majority of applications (and the application Go is primarily designed for) it's not really relevant. So unlike the guy you're replying to I wouldn't call it a con, just a different design decision.

Go is probably one of the best GC languages in this regard though because the stop is guaranteed to be under 10ms, so you can at least know that for sure.

Java8 server runtime (closed source Oracle one, not OpenJDK) uses the same algorithm more or less. Concurrent GC is really the best GC you can have.

Oracle just steals every other language's run-time optimization.

>Lastly the community is un-apologetically politically leftists and this is a real issue from people who mix politics and technical rigor.

Any examples? That seems kind of dire...

Thanks for your summary.

>-The learning curve is a fucking brick wall
this
i tried, seems too much of a hassle to deal with lifetimes and borrowing

>Rust
>The learning curve is a fucking brick wall
Oh god yes. It doesn't help that there's still very little in the way of good tutorials.
At least there's good documentation though, so you can figure shit out on your own if you have to.

I'm not sure it's as bad as makes it out to be. The guy in charge has some pretty strong political views, but I've not seen them show up on /r/rust or the website. There's a few stories that Cred Forums loves to recite, but most of them boil down to minor events when you dig into them (someone got banned from the IRC channel after posting racist shit, for example).

>i tried, seems too much of a hassle to deal with lifetimes and borrowing
97% of the time, the compiler does all of that for you.
2% of the time, it's a pain in the ass.
1% of the time you're actually trying to do something retarded, and the compiler is stopping you from shooting yourself.

They don't tolerate LGBTQ or Racial hate speech, and have a code of conduct. They aren't overboard like the Node.js community. You won't see people whining about you using Master/Slave class names. The /r/rust community will occasionally call out people on being anti-trans or racist. The conversation common goes

>Hey X isn't a good person to promote a politically inclusive community
>Yeah but at least somebody our using and support the projecting

IDK I just don't see compiler pull requests, RFCs, and mailing-lists as a race/sex political discussions. So I've never had an issue. But I generally follow the *when in rome post as romans do* motto when it comes to interacting with a community.

>97% of the time, the compiler does all of that for you.
>2% of the time, it's a pain in the ass.
>1% of the time you're actually trying to do something retarded, and the compiler is stopping you from shooting yourself.

Pretty much this. The borrow checker will beat you into submission if you come from a language like Java/Python/Ruby with a managed run-time, GC, and massages after lunch. Annotating life-times feels clumsy and awkward at first.

But once you get used to this. Your more productive then you ever were in C. You can reason about your code easier then C. You know when you are allocating, when you are freeing, what is on the stack, what is on the heap.

ive used java for the past 11 or 12 years and i struggle to learn anything different or new (haskell, even clojure).
am i just retarded or can i unlearn 12 years of brain damage?

Go is not:
>systems language
>designed to replace C/C++
>similar syntax

Except Rust's features are just a few, and they're orthogonal to eachothers, quite the opposite from C++.

Don't mention Ada, the rustfags occasionally show their autism at the mere mention of it.

GO > D > Rust > C > C++ > Java

Anyone who says different is a retard.

Anyone who thinks one language can be better then another in every case is a retard. One language can only be objectivly better then another when use case is taken into account.

Java is not in the same class as Go, D, Rust, or C/++

Not him, but I would argue that there is a lot of overlap between Java and c++ in end user applications and GUIs. D would is a better alternative to c++ in this case.

>They don't tolerate LGBTQ or Racial hate speech
That's a dealbreaker for 70% of developers.

my company used to do jsf with java.
we then switched to node which was a good decision. it made development more flexible, faster and it actually performed a lot better.
after that we went over to go. we use nothing else for the backend stuff now.
if go had a good ui library like QT my company would do desktop applications in go.

>my company constantly switches languages and frameworks

I'm guessing this is a small consultancy?

Are Mozilla insane and reinventing the wheel? Please comment below.

~300 employees
we do everything from custom made software solutions to consulting and administrating.
we work mainly with banks.
this change occured over 4 years.
before node was mature enough we stuck with jsf and java.
but no one likes java.
and it was a huge pain to deal with securty.
as node was ready for produciton we switched over. and it worked great.
however great node is.
npm is not and is a huge clusterfuck so we considered going back to jsf.
fortunately we attended a few seminars on "up and comming" technologies that looked promising.
we had the choice between going back to jsf or trying out rust and go.
we choose go over rust because it included everything you could possibly want to do in networking right from the get go. and we could pump out prototypes in days instead of weeks. like with java.
it allowed us to get more stuff done in less time with less actual work. it works as intended and is mature enough for production. we stuck with it ever since we swtiched to it two years ago.
for most desktop solutions though we have two guys which usually work with cpp and QT.
most of our applications follow the server and client model. so the backend is the same regardless.

Yes, because Rust
>invents nothing truly original and new
>is no safer than modern C++
>lacks critical features that were in Ada or Haskell decades ago
>breaks compatibility with C/C++ libraries
>randomly changes conventions for no reason

Ada doesn't even have memory safety without proprietary extensions.

Citation please

>>is no safer than modern C++
Just no.

C++ doesn't have anything similar to the borrow checker by far. Are there warnings about already-moved objects yet?

Yes, if you use a sanitizer, it raises an error.