I see a lot of Rust shilling here but seldom any actual reasons to learn it. Is everyone paid here, or if not...

I see a lot of Rust shilling here but seldom any actual reasons to learn it. Is everyone paid here, or if not, what makes Rust so great?

Other urls found in this thread:

rustbyexample.com/fn/hof.html
doc.rust-lang.org/reference.html#appendix-influences
en.m.wikipedia.org/wiki/Category:Systems_programming_languages
rust-lang.org/en-US/faq.html
adaic.org/resources/add_content/standards/05rm/html/RM-13-11-3.html#I4738
lwn.net/Articles/697267/
twitter.com/SFWRedditGifs

You can mix it with aluminum and get thermite, otherwise I don't see the point

A programming language made by the creators of the worst programmed browser cannot be very good

why does aluminum hate rust so much?

It's basically C, except it actually punches you in the face if you do something unsound at compile time.
Also, there is a slightly better standard library included.
Unlike C, you have good enough web documentations and a great package manager which unfortunately happens to download from git repositories.
Apart from that the syntax is convoluted and I don't feel like early adopting.

It also lets you program in a functional style at zero cost to performance.

Compare the top to the bottom: rustbyexample.com/fn/hof.html

As someone who likes functional pipelines, that is just sick!

Actually, that example also shows lazy infinite lists being combined with high order functional programming.

It's beautiful.

its pretty neat, a lot of the features are quite nice.

but it does have some annoying parts and is missing some useful things.

maybe when its older it will be a lot better.

also its community and the whole sjw nonsense doesnt really help.

I have never written Rust code, but a metric ton of things in the language really appeal to me.

I should try to write something in it to see how it really is though.

No standard

...

That's pretty much my take too.

It's enough of a take to be worth using. Memory safety proofs in a high-performance systems programming language are incredibly important and interesting, even if the syntax takes some getting used to.

I think the language is about as similar to C as Ruby is. (So, very little)

There's nothing wrong with C. You just have to git gud.

There is a lot wrong with C. It's to CPL what PHP is to Perl. K&R really fucked up.

...

>83% yes
lol

>being color blind

don't you dare fucking make fun of me

Err... no. It's about as similar to C as Ada is. Ruby you take both syntax away, and take away the compiler entirely. Ada is a better example because it is at least compiled to native code.

>Roughly 1 in 6 had broken code
It's like Russian Roulette: The Language.

I used Ruby as an example because Rust was partially inspired by it, particularly for its call chaining. Also, Ruby is very different than C in a lot of the same ways Rust is.

I hear you about the compilation bit though.

To elaborate: doc.rust-lang.org/reference.html#appendix-influences

tl;dr - Block syntax came from Ruby, but a lot of the things it took from other langauges also happen to be part of Ruby. (With the exception of some of the fancier functional bits)

Oh, hey... That link is far less relevant than I remember it being.

How does Rust compare to something like Clojure as a general purpose language..? I write Clojure pretty commonly, and most of the championed features of Rust seem to be things that Clojure does well too.

I mean, they are obviously very different languages, but Clojure was written with thread safety being one of its primary concerns, and from what I've read, Rust seems to just be a "Be safe or die" language in general with safe concurrency, encouraged immutability, lazy things, and functional programming.

In this respect the two languages seem both very similar to each other and very different from pretty much anything else.

So, does that make them both safe general purpose languages with Rust only having an edge from a speed standpoint and Clojure having a tighter feedback loop? Or are there particular things that Rust does better (Or worse) than Clojure from other perspectives?

en.m.wikipedia.org/wiki/Category:Systems_programming_languages

Fair enough.

My question was mostly because I was wondering if it would be worth it to learn it for side projects. Though, even though I don't do any, I really shouldn't ignore system programming.

Ada? The only thing I can think of that makes that similar is a strict compiler.

Ada and c can do the exact same thing. It just comes down to syntax and legality.

I meant Ada and Rust vs Ruby and Rust.

desu rust is pretty similar to ada. It's like ada done right more than C done right. Although I think C++ done right is the most appropriate 3-words tagline in this case.

Desu, Ada is what rust wants to be but with different syntax.

Not really. Ada has a GC in the official specs and almost all implementations and manual memory management otherwise, while rust, by design, requires neither manual memory management nor a GC.
Rust has actual support for real functional programming.
Rust syntax isn't "totally like le english language gais XDDD" so it can be practical and easy to parse.
Rust is heavily invested in tools interop, be it from macros or compiler extensions or the use of llvm or the package manager.
Just a few features that make ada obviously not something rust wants to be.

>Ada has GC
You should inform Ada core ASAP

rust-lang.org/en-US/faq.html

the call is for you to make

>I already write perfect C++. What does Rust give me?
Modern C++ includes many features that make writing safe and correct code less error-prone, but it’s not perfect, and it’s still easy to introduce unsafety. This is something the C++ core developers are working to overcome, but C++ is limited by a long history that predates a lot of the ideas they are now trying to implement.

Rust was designed from day one to be a safe systems programming language, which means it’s not limited by historic design decisions that make getting safety right in C++ so complicated. In C++, safety is achieved by careful personal discipline, and is very easy to get wrong. In Rust, safety is the default. It gives you the ability to work in a team that includes people less perfect than you are, without having to spend your time double-checking their code for safety bugs.

How does Rust's ownership system relate to move semantics in C++?
The underlying concepts are similar, but the two systems work very differently in practice. In both systems, “moving” a value is a way to transfer ownership of its underlying resources. For example, moving a string would transfer the string’s buffer rather than copying it.

In Rust, ownership transfer is the default behavior. For example, if I write a function that takes a String as argument, this function will take ownership of the String value supplied by its caller:
fn process(s: String) { }

fn caller() {
let s = String::from("Hello, world!");
process(s); // Transfers ownership of `s` to `process`
process(s); // Error! ownership already transferred.
}

As you can see in the snippet above, in the function caller, the first call to process transfers ownership of the variable s. The compiler tracks ownership, so the second call to process results in an error, because it is illegal to give away ownership of the same value twice. Rust will also prevent you from moving a value if there is an outstanding reference into that value.

C++ takes a different approach. In C++, the default is to copy a value (to invoke the copy constructor, more specifically). However, callees can declare their arguments using an “rvalue reference”, like string&&, to indicate that they will take ownership of some of the resources owned by that argument (in this case, the string’s internal buffer). The caller then must either pass a temporary expression or make an explicit move using std::move.

Try actually knowing what product you shill before doing so, adatard.

The rough equivalent to the function process above, then, would be:
void process(string&& s) { }

void caller() {
string s("Hello, world!");
process(std::move(s));
process(std::move(s));
}

C++ compilers are not obligated to track moves. For example, the code above compiles without a warning or error, at least using the default settings on clang. Moreover, in C++ ownership of the string s itself (if not its internal buffer) remains with caller, and so the destructor for s will run when caller returns, even though it has been moved (in Rust, in contrast, moved values are dropped only by their new owners

Nice being proud of your ignorance. Ada allows for a GC in the standard. It does not require it.

>How does Rust's ownership system relate to move semantics in C++?
they're mostly unrelated concepts because the abstract memory model for C and rust is widely different. In C you manipulate data, or pointers to the data. In rust, you manipulate ownership. When you "give" a value to a function, you are not necessarily copying the value and may instead be passing a pointer. When you "borrow" a value, you may in fact be copying its value.

Move semantics merely involves bypassing some parts of the copy process involving references.

The standard requires it, inbred. Maybe you should try reading the standard sometimes this century before opining on things you are clueless about.

yeah but the semantics of ownership offer a higher level of abstraction, but the typical tradeoffs of higher abstraction for less control are absent in rust

It is modern Ada.
At the core it is C with a ML type system.
The compiler openly hates you, and makes learning it an exercise in frustration. Once you clear the hurdle you really wonder how you ever programmed without it.

The functional programming is nice. And effectively free b/c the LLVM is awesome. If you look at the raw -O3 assembly it's pretty damn incredible. The in-lining is very aggressive.

Yeah, because it's handled at compile-time, that's the trick.

Maybe you should
adaic.org/resources/add_content/standards/05rm/html/RM-13-11-3.html#I4738

There are some classes of errors which are a massive pain (in particular those that have to do with ownership with regard to complex types), but aside from that, the compiler errors are god-tier, better even than ocaml's. It typically tells you not only where the error is but even exactly how to fix it, including the correct expression if you mistyped something, or which crate some module you're trying to use is from and how to import it.

exactly. if you don't need a JIT language, it's probably a good idea to do these checks at compile time

There also escape hatches via the unsafe interface so you can just fall back to good ol' fashion C way of doing things.

Yeah when you get into lazy lists with ownership involved the errors turn into these complex monsters that just dump pages of text into your terminal.

Oh. That's really cool..!

Perl 6 has a REPL that does that and it blew my mind, but something that compiles to native makes that all more impressive.

I love when these things happen

>hurr durr if I use a deprecated standard that means it's true!
Inbred.

Do you want a link to the new one so I can prove you wrong again or do you just want people to associate ignorance with rust?

Both fine options! I wonder what they will choose.

Fast as fuck
Suitable for systems programming
Type system on par with Haskell (pre-DataKinds) but cleaned up a bit

The nice thing is, there are going to be even more compiler optimizations available soon once MIR is finished.

Yep, the memory model is what really sets rust head and shoulders above the rest. There was a very thorough post about this on lwn: lwn.net/Articles/697267/
Excerpt:
>I think one important feature of modern language design is a recognition of the substantially different high-level concepts that are all handled in C using pointers. E.g. a C pointer can represent:
>* Ownership of an object (i.e. you are responsible for freeing it eventually)
>* A non-owning reference to an object (you mustn't free it)
>* Same as above but for arrays instead of individual objects
>* A non-owning reference to a range of elements within an array
>* A non-owning reference to memory of unspecified type (e.g. for memcpy)
>* An optionally-present value
>* A return value from a function
>* Any arbitrary pointer-sized number that you happen to store as a pointer type
>* Various other stuff (pointers to struct members, polymorphic types, etc)

>In C it's too easy for a programmer to lose track of the meaning of each pointer, so you get memory leaks (forgetting that a particular pointer is meant to own a resource), double-frees (thinking a non-owning reference owns its resource), null pointer crashes (some code thinks a value is optional, other code thinks it's required), use of uninitialised data (mixing up function inputs and outputs), etc.

>Languages like Java try to solve the symptoms of those bugs, not the root cause: they remove the distinction between owning and non-owning references by having the garbage collector treat every reference as a potential owner, so it usually doesn't matter if the programmer loses track (except when it does matter because there are resources other than memory), and they let you catch and ignore null pointer dereferences, and they remove the ability to point inside an array, etc, so they can claim the language is safe.

>It is modern Ada.
There is literally nothing in Rust that is more """modern""" than Ada. The entire language is redundant NIH garbage.

>using a language named after a woman
Kill yourself.

>The in-lining is very aggressive.
And getting better. The Rust compiler team is actively working on improving LLVM optimization passes in addition to the Rust compiler itself.

#blacklivesmatter!!

Rust is a meme, you should wait for BitC or keep using C

I disagree, but what is this?

Not invented here?

>BitC was a partially designed...
DROPPED

>BitC
The primary designer of BitC stopped working on the language in 2012 claiming it had fundamental design flaws.

I just really enjoy it, its good looking, easy to read, and I really like the compiler and package system.

I like the idea, I just could never bother wrestling with the borrow checker. I'll give it another try later.

>good looking, easy to read
I think Rust's syntax is actually pretty fucking ugly.
They took too much influence from C++.