RUST PROGRAMMING

I still need convincing on Rust, What makes it so great and why should I be using it?

Attached: rust-2.jpg (720x365, 93K)

Other urls found in this thread:

juliacon.org/2018/talks_workshops/42/
github.com/JuliaLang/PackageCompiler.jl
doc.rust-lang.org/std/sync/index.html#higher-level-synchronization-objects
medium.com/@cfsamson/from-48s-to-5s-optimizing-a-350-line-pathtracer-in-rust-191ab4a1a412
twitter.com/SFWRedditImages

same I'd rather learn C++

Its iterator system is saner than C++'s, its syntax is overall better, it defaults to non-mutable variables, it has consistent yet sane error handling, and its standard I/O procedures are sanely-defined macros, not some operator-overloaded mess.

what about pic related?

Attached: borrow-checker-001.png (1000x483, 57K)

>I have half-Arab-half-Pajeet programming habits
Get the fuck out of my field.

why so defensive?

.unwrap().unwrap()

>half-Arab-half-Pajeet

Attached: 1524407353537.png (686x798, 33K)

is this because of the ABI

What's wrong with that?

The Rust hype train is dying.
Pic related is the next big thing.
It's as fast as C, and although it is geared towards Data Science, with its insane metaprogramming it can do so much more, even systems level programming.
juliacon.org/2018/talks_workshops/42/

Attached: Julia_prog_language.svg.png (1200x811, 43K)

I just got started with Julia the other day. I don't understand why there's no easy way to compile it to a binary so I don't have the atrocious start-up times every time I load in a module on the REPL/run a script.

Imagine having to ask your compiler's permission to borrow memory in your own fucking program.

Attached: rust book 2.png (900x1181, 461K)

>get hyped for Julia
>check Wiki page
>dynamic typing

github.com/JuliaLang/PackageCompiler.jl

Can someone TL;DR what the borrow check is/does?

"checks" your privilege every time you compile code then asks to "borrow" 50 bucks so it can buy some drugs

The next big thing is Jai, obviously

t. Leddit

this but unironically

>It's as fast as C
in selected benchmarks... which is bullshit.

I'm not programming in a language called julia for fucks sake, do not name your language after your daughter.

The only thing going for Rust is that at the very least it is not a object oriented programming language.

>In an interview with Infoworld in April 2012, Karpinski said of the name "Julia": "There's no good reason, really. It just seemed like a pretty name."[25] Bezanson said he chose the name on the recommendation of a friend.[26]
I agree with him, it's a pretty name.

>start naming language after your gf
>break up with her
>nah dude it was just a random name
that's why you should name your creations after fictional characters, i'd code in a language called SCULLY for example, in all caps.

Rust is an ugly attempt at making a memory safe C++.

>that's why you should name your creations after fictional characters
Great idea. That way we can spot meme tech by talentless weeb retards from first glance.

It doesn't let you do stupid shit with references

Three ways to pass a variable to a function:
1. borrow: pass by constant reference
2. mutable borrow: pass by nonconstant reference
3. consume: function takes ownership of the object, the object is destroyed at the end
Borrow and consume are equivalent for primitive types (integers, floats and booleans). You can't mutable-borrow the same variable multiple times simultaneously.

I really don't know how I feel about this language, part of me wants to enjoy it and part of me doesn't

1. Ensures an object never gets moved or destroyed while a pointer to it exists (prevents dangling pointers).
2. Ensures there is only ever at most one pointer you can use to modify any object (prevents shared mutability).

i can't remember what's wrong with this but the last hn thread on it redpilled me to never use it

cope

>its syntax is overall better
You have to be a special kind of delusional to actually believe that.

>muh function pointers and typedefs

Attached: segfaulting cnile.png (627x722, 114K)

>You can't mutable-borrow the same variable multiple times simultaneously.
So effective parallelism is literally impossible. Good job.

Sorry I couldn't hear you over the sound of pub fn mut& : & mut int 64 fn -> (mut&: int var)) -> -> fn &const mut out

unsafe { ... }
No. Try again.

>Just break the fundamental core tenet of the language!
You can either insist Rust is better because its safer or you can admit it's a worthless heap of garbage that isn't even feature complete with Cpp03. You don't get to sidestep every fuckhuge problem with unsafe because then you end up using it for literally everything, and now there's no reason to bother with the language.

Rust is about reducing unsafe code to small, controlled pieces of code, not about all-or-nothing safety. I take that anytime over a giant unsafe hacker-wannabe sandbox like C, but you seem not to care about software quality, so I'm not gonna try to convince you.

Attached: goofy cnile.png (1799x825, 269K)

>effective parallelism is impossible because you can't produce race conditions

Attached: 19znwe.jpg (900x900, 60K)

Stupid comment. You are literally using a back of the box feature list as your talking points. You can write most of the major languages in whatever paradigm you want.

You could at least write valid syntax
You don't even have any lifetime annotations, 0/10

The biggest innovation in Rust is how they figured out how to morph Ruby programmers into even bigger shitwizards than either Lisp or Haskell weenies.

doc.rust-lang.org/std/sync/index.html#higher-level-synchronization-objects
Rust gives you multiple options to deal with this.

safe ways*

lmao take a look at rayon

It's the perfect language for faggots who like to produce fast programs with minimal runtime like C++ faggots, but want rely on the compiler as much as possible to verify that their code doesn't cause undefined behavior.

T. former C++ faggot who is now a Rust faggot

PS.
If you want to stick to C++, enabling as much compiler warnings as your butthole can take, and using things like the various sanitizers available for Clang/GCC gets you 90% of the way there. But if you are masochistic, and want that extra 10% at the cost of being harassed by the borrow checker, then Rust is the way.

imagine asking your os's permission to borrow memory on your own fucking computer.

bump

>Almost any computer program is basically data manipulation
>it defaults to non-mutable variables
>Presenting immutability as an advantage
Functional autism as is
Now go use some overcomplicated monad to output a single line of text

Now do that in C

Nice UB you got there

Do what?
Write autistic pseudocode that vaguely resembles actual code if you squint?

Not that user but if you write safe code then there isn't any unsafe code in your program

it checks your cis white male privelege and unoptimizes your code if it thinks you are white so other races can beat you to the dev positions on the technical interview
their big flaw is that nobody cares about rust

> non-mutable variables
So run time constants are called variables in rust. Yikes!

see

The sbrk system call does exactly that.

medium.com/@cfsamson/from-48s-to-5s-optimizing-a-350-line-pathtracer-in-rust-191ab4a1a412
>rewrite c# code in rust
>uses less than 1/4 of the memory it did in c#
how is rust so good?

For starters, it's compiled. Then, it's not by Microsoft.

What would you write in Rust?

Same kind of things I'd write in C/C++.