[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I see a lot of Rust shilling here but seldom any actual reasons

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 68
Thread images: 10

File: grungy-rust-styles.jpg (123KB, 700x490px) Image search: [Google]
grungy-rust-styles.jpg
123KB, 700x490px
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?
>>
You can mix it with aluminum and get thermite, otherwise I don't see the point
>>
>>56259650
A programming language made by the creators of the worst programmed browser cannot be very good
>>
>>56260316
why does aluminum hate rust so much?
>>
>>56259650
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.
>>
>>56260371
It also lets you program in a functional style at zero cost to performance.

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

As someone who likes functional pipelines, that is just sick!
>>
>>56261191
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
>>
File: No standard.gif (4MB, 420x315px) Image search: [Google]
No standard.gif
4MB, 420x315px
>>56261738
>>
>>56260371
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.
>>
>>56260371
>>56261841
I think the language is about as similar to C as Ruby is. (So, very little)
>>
>>56260371
There's nothing wrong with C. You just have to git gud.
>>
>>56263157
There is a lot wrong with C. It's to CPL what PHP is to Perl. K&R really fucked up.
>>
File: after_1_0_broke_code.png (61KB, 1248x536px) Image search: [Google]
after_1_0_broke_code.png
61KB, 1248x536px
>>56261738
>>
>>56263355
>83% yes
lol
>>
>>56263455
>being color blind
>>
>>56263468
don't you dare fucking make fun of me
>>
>>56262804

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.

>>56263355

>Roughly 1 in 6 had broken code
It's like Russian Roulette: The Language.
>>
File: Ruby_Design.jpg (66KB, 600x300px) Image search: [Google]
Ruby_Design.jpg
66KB, 600x300px
>>56263533
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.
>>
>>56263953
To elaborate: https://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)
>>
File: 1420605111401.gif (2MB, 479x349px) Image search: [Google]
1420605111401.gif
2MB, 479x349px
>>56263991
Oh, hey... That link is far less relevant than I remember it being.
>>
File: ChespinConfused.png (41KB, 224x224px) Image search: [Google]
ChespinConfused.png
41KB, 224x224px
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?
>>
>>56265505
https://en.m.wikipedia.org/wiki/Category:Systems_programming_languages
>>
>>56265537
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.
>>
>>56263533
Ada? The only thing I can think of that makes that similar is a strict compiler.
>>
>>56266742
Ada and c can do the exact same thing. It just comes down to syntax and legality.
>>
>>56266950
I meant Ada and Rust vs Ruby and Rust.
>>
>>56266742
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.
>>
>>56267171
Desu, Ada is what rust wants to be but with different syntax.
>>
>>56267252
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.
>>
>>56267298
>Ada has GC
You should inform Ada core ASAP
>>
>>56259650
https://www.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.
>>
File: eggplant emoji.jpg (66KB, 700x700px) Image search: [Google]
eggplant emoji.jpg
66KB, 700x700px
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.
>>
>>56267324
Try actually knowing what product you shill before doing so, adatard.
>>
File: 1466411395894.jpg (37KB, 540x808px) Image search: [Google]
1466411395894.jpg
37KB, 540x808px
>>56267346
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
>>
>>56267360
Nice being proud of your ignorance. Ada allows for a GC in the standard. It does not require it.
>>
>>56267346
>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.
>>
>>56267388
The standard requires it, inbred. Maybe you should try reading the standard sometimes this century before opining on things you are clueless about.
>>
>>56267416
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.
>>
>>56267435
Yeah, because it's handled at compile-time, that's the trick.
>>
>>56267431
Maybe you should
http://www.adaic.org/resources/add_content/standards/05rm/html/RM-13-11-3.html#I4738
>>
>>56267451
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.
>>
>>56267493
exactly. if you don't need a JIT language, it's probably a good idea to do these checks at compile time
>>
>>56267493
There also escape hatches via the unsafe interface so you can just fall back to good ol' fashion C way of doing things.
>>
>>56267510
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.
>>
>>56267510
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.
>>
>>56267431
>>56267496
I love when these things happen
>>
>>56267496
>hurr durr if I use a deprecated standard that means it's true!
Inbred.
>>
>>56267988
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?
>>
>>56268152
Both fine options! I wonder what they will choose.
>>
>>56259650
Fast as fuck
Suitable for systems programming
Type system on par with Haskell (pre-DataKinds) but cleaned up a bit
>>
>>56267451
The nice thing is, there are going to be even more compiler optimizations available soon once MIR is finished.
>>
>>56267416
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: http://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.
>>
>>56267451
>It is modern Ada.
There is literally nothing in Rust that is more """modern""" than Ada. The entire language is redundant NIH garbage.
>>
>>56269094
>using a language named after a woman
Kill yourself.
>>
>>56267451
>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.
>>
>>56260370
#blacklivesmatter!!
>>
File: logo.png (3KB, 70x70px) Image search: [Google]
logo.png
3KB, 70x70px
Rust is a meme, you should wait for BitC or keep using C
>>
>>56269523
I disagree, but what is this?
>>
>>56269094
Not invented here?
>>
>>56269523
>BitC was a partially designed...
DROPPED
>>
>>56269523
>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.
>>
>>56259650
I like the idea, I just could never bother wrestling with the borrow checker. I'll give it another try later.
>>
>>56270378
>good looking, easy to read
I think Rust's syntax is actually pretty fucking ugly.
They took too much influence from C++.
Thread posts: 68
Thread images: 10


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.