Rust

Explain the fuzz to a Java/C++ guy.

Other urls found in this thread:

youtube.com/watch?v=agzf6ftEsLU
en.wikipedia.org/wiki/Comparison_of_type_systems
rust-lang.org/en-US/conduct.html
wiki.archlinux.org/index.php/Code_of_conduct
twitter.com/NSFWRedditGif

This ugly son of a bitch is writing memory-safe code and basically, you are fucking stupid.

How?? ...Just Watch The Free Video> youtube.com/watch?v=agzf6ftEsLU

Can rust prevent memory leaks without using the GC?

rust doesn't have GC

I thought it was optional? Or maybe that was D?
Anyway can rust prevent memory leaks?

Rust has no GC, you're thinking about D.
Rust prevents memory leaks through RAII, but it's not idiot safe and it's not considered a memory error.
Rust guarantees against memory errors and data races.

Rust is safe.

Fpbp

Bump. I too want to know why I would push my C++ knowledge out of my tiny brain and replace it with Rust.

Actually I fucking loath C++, but Rust looks significantly uglier and seems like hipster trash.

rust kinda sucks. It's run by SJWs who ban people who don't follow their code of conduct. The language itself is just meh. It's not too difficult to check if a pointer is null in C or C++ tho

Does it have dynamic types? Then it leaks memory. Are types compiled before runtime? Then maybe it doesn't have leaks.

Take a look at this list on wiki: en.wikipedia.org/wiki/Comparison_of_type_systems

It says C# Sharp is static typed, this is a lie. C# sharp has dynamic typing and JIT. They call this "strong" typing. Strong is a relative word. Strong compared to what? It's weak compared to static typing...

What languages are actually statically typed? Only Assembly which doesn't have types really, since the type is defined and implemented at the hardware level, technically there are no memory leaks because there's no memory it can leak to.

Pretty much every programming language has types, these types are almost never representative of the lower layer (minus vanilla C) , so it is subject to memory leaks.

As soon as your language introduces dynamic types, static checking becomes an intractable problem. This problem can be constrained to a domain with logically proven set/proven type theory. Does your language of choice use a proven type system? The only language I can think of off the top of my head that does is SQL and COBOL

A failed attempt at agda, hence started making C and called it "safe".

>Rust is safe

fucking idiot

it's just an autist (sjw) version of C / C++. The only difference is it's compiler is retard-proof by not compiling if it's can reference a null pointer

Good argument, tripfag

reminder that everyone that uses the sjw argument for why Rust isn't a great language, is below the age of 18.

>rust-lang.org/en-US/conduct.html
> tfw banned from a programming language

I don't get it. All I see here is Rust being fast.

>implying you made one
lol
spotted the pythonista

>Can't understand the range of a 32 bit integer
Shill indeed

>>rust-lang.org/en-US/conduct.html

samefag, nigger

...

kek

wiki.archlinux.org/index.php/Code_of_conduct

> banned from using an operating system

Really just
>banned from an irc channel

Also this is literally lifted from node.js, yet no one gives them shit.

It only prevents if it catches the memory leak.

Nobody is pretending Node has any redeeming value.

Leaks are not possible in safe Rust. It's not like the compiler is doing arbitrary static analysis checks. Language rules itself enforce this.

It's just glorified ada with the hypetrain of webdev crybabies who can't be bothered to use static analysis when writing C.

C is still the only choice for safety critical systems

/thread

Rust shills didn't do too well this thread

>C is still the only choice for safety critical systems
Explain
Wouldn't even ada be better for safety critical applications?

I was the one who made that benchmark while I was learning Rust. I didn't know about cargo (Rust's project manager that automates build, checks, execution etc) back then.

Ada would be ideal, but c compilers are easier to make

I don't get it, how does that explain safety?
I must be retarded.

Ada used to be the preferred choice. C tooling has come far enough for it to be used for mostly everything. There are still new projects being written in ada, but lot of the stuff that used to be ada is now subset of C, checked with assistants (you can even try free ones such as framaC). You get much faster proofs for code that needs it and, reasonable guarantees of safety for other code.
There really should be no reason for you to start something new in ada unless you already have a lot of ada code to be reused

what? any system that sticks with reference counted pointer instead of full blown tracing-from-root GC is vulnerable to idiot devs making inadvertent cycles that can hang around forever.

It doesn't, whoever wrote is shitposting. Spark is still better than Misra C.

Here is my two cents:
If you want really intuitive, neat and clean syntax but okay to use garbage collector use D. It's a very nice language and the performance is pretty impressive. In fact I think it's the fastest garbage collected language in existence.

However if you want a good project development environment, comparatively much safer but fast, efficient program go use Rust. Rust has some really nice mixture of functional and linear imperative programming. The syntax is quite ugly and the libraries aren't mature yet. Because of the lack of maturity the syntax is quite a mess as of now.

I myself believe that using C made me a lazy programmer. It's not C's fault. However Rust forces you to write safer and optimized code. So if it compiles, it's almost okay to publish your work unlike other languages.

use std::rc::Rc;
use std::cell::RefCell;

type Shared = Rc;

struct Cycle {
name: String,
inner: Option,
}

fn shared(name: &str) -> Shared {
Rc::new(RefCell::new(Cycle {
name: name.to_owned(),
inner: None,
}))
}

impl Drop for Cycle {
fn drop(&mut self) {
println!("Dropping {}", &self.name);
}
}

fn main() {
let a = shared("A");
let b = shared("B");
a.borrow_mut().inner = Some(b.clone());
b.borrow_mut().inner = Some(a.clone());
println!("OH NO!");
}

error[E0412]: cannot find type `Shared` in this scope
--> src/main.rs:3:19
|
3 | inner: Option,
| ^^^^^^ not found in this scope
|
= help: possible candidate is found in another module, you can import it into scope:
`use std::ptr::Shared;`

error[E0412]: cannot find type `Shared` in this scope
--> src/main.rs:6:26
|
6 | fn shared(name: &str) -> Shared {
| ^^^^^^ not found in this scope
|
= help: possible candidate is found in another module, you can import it into scope:
`use std::ptr::Shared;`

error[E0433]: failed to resolve. Use of undeclared type or module `Rc`
--> src/main.rs:7:5
|
7 | Rc::new(RefCell::new(Cycle {
| ^^^^^^^ Use of undeclared type or module `Rc`

error[E0433]: failed to resolve. Use of undeclared type or module `RefCell`
--> src/main.rs:7:13
|
7 | Rc::new(RefCell::new(Cycle {
| ^^^^^^^^^^^^ Use of undeclared type or module `RefCell`

error: aborting due to 4 previous errors

error: Could not compile `test1`.

Misra is cancer. Saab's C guidelines are superior in every way

It's defined right there you clown. Try pasting the entire thing next time.

>Java/C++ guy
Why do people act like these two languages are even remotely alike?

...but muh OO

You can't finish learning C++

You can finish learning Rust :^)

golang I think?

Go's GC is not optional, D's GC is optional

Oh I thought it was, my bad.

Never heard of it.

Its a gender inclusive language that promotes judgement free coding