Rust

Give me one good reason I shouldn't start using it

Attached: 1200px-Rust_programming_language_black_logo.svg.png (1200x1200, 56K)

Other urls found in this thread:

benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=gpp
doc.rust-lang.org/src/alloc/rc.rs.html#1191
doc.rust-lang.org/src/alloc/rc.rs.html#395
twitter.com/NSFWRedditGif

If you're insecure enough to ask Sup Forums what language you should learn, maybe you should go back to liberal arts or humanities instead.

garbage lang that no one in the industry would use

It has like 1 neat feature, to disallow usage after move. Most static analysis tools can detect that.
So why make a new language thats all about that+

Its a really great language and you should use it

Detecting possible/definite use after frees doesn't catch as many cases as move semantics and borrow checking, nor is it as good at acting as a programming aid.

Reasons to not use rust:
>Mind boggling compile times
It's literally like 5-10 minute build times for any medium size projects, even with incremental compilation. It's unbearable.
>Very immature
There will be libraries to do what you want, and their design will (probably) be better than C++ counter parts, but you'll (also probably) have to make PRs for things that they're missing for your use case.
>No vendor support
If you want to do embedded programming, you can't go into it hoping to just follow a vendor's guide or some blog post of "How 2 code MCU". You're going to have to do a lot of leg work. You also can only target clang backends, notably that means ESP8266 is out of the question.
>Borrow checker is an absolute cunt if you're working in environments that don't like safe code
A big example is opengl and graphics programming in general, which seems to LOVE to pass around handles to resources willy nilly.

It's a very fun language though. It's very easy to make things work (actually work, not javascript "it looks like its working but who knows" work) and you rarely get frustrating nonsensical issues caused by undefined behaviour or cryptic compiler errors.

Thx good post

Rust is better than : JS, C#,Java,C++,Python, Ruby and every other language, except of course C

Yep, only Zig is better than C

Attached: Zig is on track..png (1110x166, 19K)

garbage collection, requires a runtime, fewer libraries than C/C++, generates slower code than modern C++ compilers.

Why /should/ you start using it?

>being the meme

Attached: rust shill hd.png (2955x2785, 785K)

saved
i'm not saying Rust is good, just that its better than everything else out there except C, why is it better? its compiled and has enough chasity in compiler checks to prevent SJWs from fucking up so you can just import their crate and hope it werks :^)

there is no GC or runtime for Rust and by all benchmarks Rust beats C++

Attached: DRqZ64fWsAE8Rtu.jpg large.jpg (460x960, 85K)

it's pretty obvious everyone is sick of c++ and wants it gone as much as is possible

>everyone is sick of c++ and wants it gone
I think you misspelled "every brainlet".

Also
>Mind boggling build sizes
Not the final executable (which are typical for statically linked binaries) but >1GB for your ./target directory is normal.

Maybe once it's stable.

does that make you a zigger

>by all benchmarks Rust beats C++
No it doesn't. For a select few benchmarks which the Rust team micro-optimized it does, but not for long.

>Rust beats

my ass.

a few updates in c++ compiler will probable beat the shit out of rust.

There are none. If you want to use rust then use rust. if you want to use another language then use it.
fuck off

this is fucking hilarious. at the bottom of its main page it lists all six projects that have ever been made with zig.

The Kos aspect ruins the player interaction desu

because only sjw nu-male beta cuck bugmen soyboy redditors use rust

Sorry code monkeys thats' just how it is, now back to writing that Qt C++ !! Soon you'll gotta learn Rust or your boss might fire you. Did you really think Java native will last forever? ^_^

>Qt C++

another fucktard who think c++ is used only for QT..

ps. i am the boss

>needs more than 32 GiB to compile sjwfox on TMPFS

we're talking about rust not c++

yes im sure you calculating how to get the most out of LSD or DSB when "programming" in C++

Object Pascal

because c++ is unironically better

std::make_unique

Firefox Quantum uses Rust, not C++.

How about Crystal you guyz?

desu if there was a way to convert Rust code into C, there'll be a higher adoption for more obscure platforms, like literally almost every MCU on the market that only has a C compiler.

You don't choose the language you will use.
What you boss want you to use is what you will use.
Even if it's Commodore Basic.

>compiled scripting language
that should go well

If you could do that, why not just use C in the first place?
Rust is pretty much just C but "safe".
If C isn't inherently unsafe, then safety in can be enforced through enforcing best practices and compiler errors/warnings

>std::make_unique
Explain why

It's designed as a systems level language, so it's biggest rivals are C and C++. I've taken an interest in rust over the past couple of years simply because of the safety guarantees without compromising performance. I started writing a text editor in rust to try and become more proficient, but the better I became the less appealing the language was. The syntax feels really over-encumbered in it's safety bullshit. Eventually I lost interest in learning it because I started doubting rust's ability to replace C as a serious systems-level programming language. It's simply a tedious syntax, and all for the sake of hand-holding for bad programmers.
Now I'm not saying C++ doesn't have a tedious syntax, but it's definitely less so, plus generally more familiar to most people (like those who have used Java, Javascript, C, etc.). And yes, it can be unsafe - if you're fucking stupid about how you use it. Any C++ programmer with the tiniest amount of experience and half a brain will know how to abstract ‘new’ and ‘delete’ calls with RAII, or use thread-safe data structures to pass information between threads. It's hardly brain surgery, but people still manage to fuck it up time and time again. Why? Because people are fucking stupid.

Keeping that in mind, consider this:
1. One of the first things you learn in C++ is ‘new’ and ‘delete’ are evil. They can royally fuck you over. Only use them if you have to, and even then abstract them through a safe interface.
2. One of the first things you learn in rust is ‘unsafe’ is evil. It can royally fuck you over. Only use it if you have to, and even then abstract it through an safe interface.
Woah! It’s almost as if the kind of person who is going to fuck up ‘new’ and ‘delete’ in C++ is also going to fuck up ‘unsafe’ blocks in rust. And if you’ve ever imported a crate in rust, you’ll know that unsafe blocks aren’t uncommon, apparently because many programmers would rather just quickly write something in an ‘unsafe’ block that just works instead of wrestling their safe logic through the compiler.
In addition I’d like to point out that the C++ programmer who can’t use ‘new’ and ‘delete’ without blowing their leg off probably isn’t so great at programming altogether, and is probably going to introduce simple logic-based bugs whether they’re using C or fucking python.

make_unique does not suffer from the problems of constructing unique_ptrs, it will do all the necessary checks.

>The syntax feels really over-encumbered in it's safety bullshit.
This is what made me realize that Rust is a meme.

Having said all that, C++ is inelegant and bloated. It's only where it's at today because it's fast, it's (mostly) a superset of C, and there's a C++ library for just about everything. Anyone who claims to like C++ for the language itself doesn't know it very well or has a very bad case of Stockholm syndrome. It’s why everyone’s always on their toes about a C++ killer coming along to swoop in and save them from it, and why people keep trying to make it happen. The bitter truth is that it'll stay where it is for a very long time because it's not *quite* bad enough for organizations to bother migrating away from it, not unlike how Unix wasn’t/isn’t quite bad enough for organizations to bother migrating to Plan9. And not unlike Unix-y systems getting stuffed with Plan9 features like the /proc/ filesystem, C++ is being drip fed features from almost every other language.

Tldr; all languages are kind of shitty in their own ways, people are stupid and will fuck up programming regardless of the language, and you should just use whatever you can tolerate, pays well, and works for the task at hand. Oh, and using rust won't suddenly give you godlike programming abilities. At best it will prevent a few memory leaks and at worst it will slow development down a lot.

you end up putting everything in unsafe blocks if you replace rust with c, so it doesn't really matter. also, rusts safe is actually "safe", not safe.

I'd use C++ only and only for Qt
>bindings
half assed and broken; fuck off

what bloated even means? java standard is as long as c++? have a look at js, where everything is fragmented because the lang is too simplistic&generic. this will happen to rust also, where crates will be frameworks that get old in a year. not a surprize that the same idiots JS/web people are promoting rust

>what bloated even means?
Whether you like C++ or hate it, you have to admit that in revisions 03 to 17 there has been a huge amount of stuff added.
>java standard is as long as c++
I don't believe I made a comment about the java language standard.
>have a look at js, where everything is fragmented because the lang is too simplistic&generic
>everything is fragmented
How so? If you're referring to libraries and frameworks, then keep in mind nobody is forcing anyone to use them - people choose to use them.
>the lang is too simplistic&generic
There are many words I would use to describe javascript but 'simplistic' and 'generic' are not among them. The picture I posted summarises my feelings towards it.
>this will happen to rust also, where crates will be frameworks that get old in a year
This happens in every language. Libraries are all about not reinventing the wheel, which is why they're supported in just about any decent language. Reusable components are a principal of good engineering, if not just common sense.
>not a surprize that the same idiots JS/web people are promoting rust
I don't think I'm much of a javascript or web person. Most of the recent trends in front end and back end web development rub me the wrong way. Also if you think I'm promoting rust, maybe read the prior posts I made:
I was merely suggesting that C++ is not without it's problems.

Attached: simplisticANDgeneric.png (328x323, 21K)

You need to be productive immediately

rust programmers
> LMAO go suxxxors, it doesn't have generics

also rust programmers:
> I cannot implement a double linked list

you laugh now, wait a few years when Rust beats out C in performance. it's already faster than C++

>also rust programmers:
>> I cannot implement a double linked list
Wrong.
use std::cell::RefCell;
use std::rc::{Rc, Weak};

struct Node {
pub data: T,
pub prev: Option,
pub next: Option,
}

impl Node {
pub fn new(data: T) -> Self {
Self { data, prev: None, next: None }
}
pub fn append(node: &mut Rc, data: T) {
let is_last = node.borrow().next.is_none();
if is_last {
let mut new_node = Node::new(data);
new_node.prev = Some(Rc::downgrade(&node));
node.borrow_mut().next = Some(Rc::new(RefCell::new(new_node)));
} else {
if let Some(ref mut next) = node.borrow_mut().next {
Self::append(next, data);
}
}
}
}

struct List {
first: Option,
last: Option,
}

impl List {
pub fn new() -> Self {
Self { first: None, last: None }
}

pub fn append(&mut self, data: T) {
if let Some(ref mut next) = self.first {
Node::append(next, data);
let v = self.last.as_ref().unwrap().borrow().next
.as_ref().unwrap().clone();
self.last = Some(v);
} else {
let f = Rc::new(RefCell::new(Node::new(data)));
self.first = Some(f.clone());
self.last = Some(f);
}
}
}

100% written in safe Rust

Valid point.
Most jobs doesn't require wizards.

>it's already faster than C++
sure, senpai.

>self.last.as_ref().unwrap().borrow().next.as_ref().unwrap().clone();

Attached: This+cunt+wants+to+quotclaim+back+spainquot+but+all+hes+_6ba3a259b0e4368043945291b77ee9ed.jpg (912x905, 94K)

>already faster than C++
It is multitudes slower than sepples in all but two tests.
benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=gpp

I never said it wasn't greasy. but It's definitely a doubly linked list in rust without any of the "unsafe" features.

>I never said it wasn't greasy
The new word to describe Rust, thanks s e m p a i

>Guys
>Guys
>Hey guys I got an ide-
>GUYS!
>Listen guys what if
>Guys what if we
>Guys let's take the verbosity of Java
>Guys listen
>What if we took the verbosity of Java
>And used C++ syntax?

>Weak RefCell
doc.rust-lang.org/src/alloc/rc.rs.html#1191

>RC RefCell
doc.rust-lang.org/src/alloc/rc.rs.html#395

Attached: maxresdefault.jpg (1280x720, 54K)

>Even safe code is unsafe
What a lovely language

Attached: rust unsafe sweep under the rug.png (620x463, 273K)