4 ms·
Lots of interesting thoughts, and a good outline of ownership's limitations, but I think some big leaps were made. "Fatal flaw" is quite a hyperbole, and the co
by brundolf 6y ago
Lots of interesting thoughts, and a good outline of ownership's limitations, but I think some big leaps were made. "Fatal flaw" is quite a hyperbole, and the comparison to OOP, while interesting, is much too hand-wavy to be used as evidence for that assertion.
But they were spot-on about what is arguably Rust's biggest weakness, and the things people do to work around it, and I think there's kind of an open question whether that status-quo can be improved upon. I.e. Rust right now is excellent at certain things ("linear things"), and okay at non-linear things. But could it be made to be really good for the latter too? Or will it remain somewhat confined to its specialization? The language occupies uncharted territory either way, so these kinds of questions are not surprising, and I for one am excited to see where things go.
- dan00 6y ago> I.e. Rust right now is excellent at certain things ("linear things"), and okay at non-linear things. But could it be made to be really good for the latter too? Having written programs in Rust and Haskell, which are in this regard quite similar, I think that you can express most of your application in a "linear" fashion and only have a bit of "non-linear" things at the top. For example if you have to handle some "non-linear" things like events from the system or a gui library, then you might have - in Rust terminology - a 'RefCell<Rc<AppState>>' to be able to have shared mutable access to the application state. At the top of the event handler you would transform the 'RefCell<Rc<AppState>>' into a '&mut AppState', which is the switch from the "non-linear world" to the "linear world" and involves a runtime check that there's only one mutable reference. All the following code of the handler can then be verified at compile time. This also makes the reasoning about the application easier, because you might even reduce the mutation of your application state to the switching area. So most of the event handling could be a pure transformation of the application state.
- nicoburns 6y agoI think Rust (or a new Rust-like language) could potentially be improved significantly by having language-level sugar for things like Rc<RefCell<T> Arc<Mutex<T>> or even some kind of Gc<T>.
- DougBTX 6y agoThere are experiments for a Gc<T> here: https://github.com/Manishearth/rust-gc https://github.com/Manishearth/rust-gc
- db48x 6y agoIf you find yourself wishing you didn't have to type some combination of types so often make a type alias. But the primary reason there's no built-in shortcut is that you might want to compose them in a different order.
- alkonaut 6y ago> "Fatal flaw" is quite a hyperbole, I think one should just assume headlines are hyperbole and live with it. No one would read the article "A nuanced critique of ownership semantics" no matter how good it was. The only reason we are discussing it is because someone chose to make it hyperbolic. That's unfortunate but it is what it is.
- rq1 6y agoI would read it. The article is crap overall given what the title promised.
- alkonaut 6y agoI’d do it too - but we wouldn’t see it because it wouldn’t be here on the front page, so we’d be much less likely to even stumble across it.
- petertodd 6y agoAn advantage of reserving language like "A Fatal Flaw in Foo" for situations where there really is a fatal flaw in Foo is it gives headlines more dynamic range.
- a1369209993 6y agoThe problem with that is that you can't actually have that advantage because of headlines like this one engaging in loudness wars.
- gingerBill 6y agoI am the author of the article and the "Fatal Flaw" is hyperbolic on purpose, and a mild reference to the downfall of a protagonist in a story. As for where other languages can go in this area, it would be interested to explore the idea of tracking "uses" in general. It might be useful for the compiler but not necessarily an intrinsic language feature. My issue with Rust is that it went headlong into an unproven idea and those issues are now showing.