>this compiles and works as expected What did Rust mean by this? I thought I wasn't supposed to have multiple mutable references. Whatever it was trying to stop me from doing with its borrowing rules can obviously be done that way, so what is the point?
>curly braces >esoteric Not every memelang is esoteric.
Jacob Rogers
you dont have multiple mutable references. the references are destroyed after the expr evals
Cameron Richardson
>b-b-b-but technically I have multiple handles on the same piece of data, and I can mutate it through each one at will. It is effectively the same thing as having multiple mutable references except for the ugly syntax and superfluous reference counting, so what's the point of the restrictions? It only makes code uglier.
Christian Adams
>Rust why anybody would use anything other than Go for systems programming is beyond me
Aiden Adams
performance, mostly.
Samuel Flores
>Go Why anyone would bother with Go over C is beyond anybody sane. At least Rust has some interesting features.
Jaxson King
i guess, though benchmarks are all over the map depending on the computation. Go's getting faster though.
I find Go elegant and easier to write and maintain, more so for large projects. It also has a nice ecosystem and tools.
Landon Lee
I had no idea R was such an interesting language
Array
Thomas Nguyen
Go is an example of a language that compiles to native code, but which is NOT a systems language. And so long as it has a mandatory garbage collector, it can never be a systems language, because it is restricted to hosted environments where there is an assumption about how memory is allocated to begin with.
Jonathan Roberts
Why Rust syntax is to shitty?
Caleb Cruz
Start as OCAML variation, some autist want remove GC with weird memory model.
Luis Phillips
>I find go elegant were you dropped on your head as a child?
Christopher Russell
desu this is my main problem with rust too; i love it otherwise
but on the other hand i can't think of many ways to improve the syntax, aside from dropping "::" (seriously, kill "::" with fire in all languages) and annotating lifetimes with literally anything other than "'"
Juan Perry
With pointers and a bit of unsafe code you can opt-out of all of Rust's safety guarantees
Luis Turner
>With pointers and a bit of unsafe code But this doesn't use pointers or unsafe code, and it still does something that should not be done according to Rust's designers. What's the point of having such a restriction if it's so easy to work around (at the cost of ugly code), especially given how often you do have to work around it?
Elijah Lopez
What is the problem here? It looks like the compiler was able to prove you aren't doing anything naughty with those references. Now try to split this code into functions/run it in different threads and see what happens.
Matthew Allen
>It looks like the compiler was able to prove The compiler wasn't able to prove anything. RefCell does the borrow checks at runtime. As far as the compiler is concerned, these are all non-mutating references, except for the borrow_mut bits (which die immediately after use).
Carson Campbell
This is the whole point of RefCell. Instead of checking borrow rules at compile-time, it does it at run-time, which in this specific program didn't cause problems.
Daniel Adams
Thanks for the correction. I've just started learning Rust myself.
Dylan Taylor
That's what you use RefCell for, it's for interior mutability.
The borrow checking is done at compile time, you'll get a panic if you have an active `cell::Ref` when you call `borrow_mut()`. You have to uphold those invariants yourself.
What's your point?
Carson Edwards
Both the compile-time and the run-time borrow checking is circumvented in that snippet. There are effectively 3 mutating references in that snippet, all munging the same piece of data.
Bentley Parker
>std::vec::Vec >std::rc::Rc >std::cell::RefCell >let s = Rc::new(RefCell::new(128))
I thought rust was supposed to be less verbose than sepples, but that shit is just unnecessary.
Nolan Wilson
>let s = Rc::new(RefCell::new(128)); >auto s = std::make_shared(new Box(123)); Sepples loses out even in this example.
Ian Morgan
There aren't you dimwit.
Luis King
Except you're ignoring the using clause in the beginning and you're using make_shared wrong (you're supposed to use it instead of new).
auto s = make_shared(Box(123));
Lincoln Hill
>Go for systems programming TOP KEK
Evan Cox
>There aren't Then how come I can modify the same piece of data through multiple different handles that coexist, subhuman? You can make as many mutating references as you like. This is an objective and undeniable fact. Rust's rules are just blind to this fact because the language was designed by retards, for retards.
If Box's constructor isn't declared as explicit, you can even do this:
auto s = make_shared(123);
Adrian Perez
DELED TIS
Nolan Gutierrez
Rust shills BTFO.
Carter Stewart
Rust has some nice features but it doesn't have many libraries. I wish Qt were ported successfully into Rust
Evan Butler
It was never supposed to be less verbose than C++, verbosity is never taken into consideration in the designing, explicitness on the other hand...
Bentley Ramirez
>verbosity is never taken into consideration in the designing Good thing nobody outside of a small group of circlejerking memers is going to have to deal with this language.
Cooper Campbell
I'd rather have a bearably verbose and barely implicit language than a bearably verbose and barely explicit language.
William Garcia
Too bad Rust is unbearably verbose, unbearably implicit and overall poorly thought out, as demonstrated by my original post.
Chase Brooks
Tell me more.
Chase Gonzalez
I think this demonstrates quite well both how ugly it is and how poorly thought out it is: use std::rc::Rc; use std::cell::RefCell;