4 ms·
Some language guy told me that Rust's ownership system is untenable. He said that researchers tried the same thing years ago and it was concluded to be impossib
by TwoBit 12y ago
Some language guy told me that Rust's ownership system is untenable. He said that researchers tried the same thing years ago and it was concluded to be impossible to work well. I know that's vague, but he claimed to know what he was talking about.
- conradk 12y agoMost of the time, Rust's ownership system is helpful. Sometimes, it's a pain though. In these cases, you can actually work around the ownership system if you need too. For instance, you can use Arc [1] to share memory between threads or Rc [2] to enable thread local GC for a specific variable or RefCell [3] to safely share mutable memory between threads. You can even use raw pointers: it's unsafe (and therefore has to be wrapped in an "unsafe { ... }" block) but possible. Finally, you can call C very easily from Rust [4]. [1] http://doc.rust-lang.org/std/sync/struct.Arc.html http://doc.rust-lang.org/std/sync/struct.Arc.html [2] http://doc.rust-lang.org/std/rc/struct.Rc.html http://doc.rust-lang.org/std/rc/struct.Rc.html [3] http://doc.rust-lang.org/std/cell/struct.RefCell.html http://doc.rust-lang.org/std/cell/struct.RefCell.html [4] http://doc.rust-lang.org/book/ffi.html http://doc.rust-lang.org/book/ffi.html
- steveklabnik 12y agoYou should ask him to get in touch. If something's broken, we want to know about it.
- pcwalton 12y agoRust goes a lot farther than academic languages that used regions like Cyclone or the ML Kit. In particular, Rust's regions are only used to enforce stack discipline, and the basic memory management is taken from C++. This way, we avoid the well-known limitations of "classical" region-based memory management. Besides, consider the fact that we've written hundreds of thousands of code for working, non-toy projects in the language, including the Rust compiler, crates.io, Servo, etc.
- jroesch 12y agoResearchers will often say things like this about techniques they couldn't get working as a way to explain away their failures. Often times some one will come along a couple years later and do exactly what they claimed was impossible or untenable. I've heard people claim that improvements on their techniques are impossible, and that proposed improvements "won't work" when it in fact does (source: I've seen this happen in the research community more than once).
- Animats 12y agoI was one of the people who proposed something like that, back in 2001, as a "strict mode" for C++.[1] I wrote "The basic concept is that pointers and references explicitly declared as auto can't be used in ways that would let the data they contain outlive the scope of the auto variable." This is what Rust calls "borrowing". (That was written before C++ repurposed the "auto" keyword for other languages call "let".) As a retrofit to C++, that idea wasn't going to work. It would have either been too restrictive or unsafe. It had to be built into the language at a deeper level. That's what Rust does. [1] http://www.animats.com/papers/languages/cppstrictpointers.html http://www.animats.com/papers/languages/cppstrictpointers.ht...