4 ms·
> But the object system (yeah, they're called structures and traits) is too weird. It's equivalent to writing C++ with: * No structural inheritance (i.e. no
by tomjakubowski 10y ago
> But the object system (yeah, they're called structures and traits) is too weird.
It's equivalent to writing C++ with:
* No structural inheritance (i.e. no inheritance of data)
* Inheritance only from pure virtual interface classes
* MyCppPureVirtualClass * pointers in various interfaces
Except that traits are also usable for static dispatch as in templates/concepts.
This isn't the most common style of C++, but it's not uncommon either, and I happen to like it a lot; it's all over Cef's and Chromium's code, for example.
> The enum approach to variant records is too weird.
What's weird about it? It's just the same as e.g. Haskell, ML, but with a different (arguably slightly overloaded) keyword. Swift uses the same terminology.
> The error handling is too weird.
Eh. I certainly like the way that explicit error handling is "forced" on the caller with mechanisms like Result<T,E>::unwrap. But I agree that magical things like the question mark operator are a little too cute.
> There's too much unnecessary originality.
FWIW, I can't think of much real originality in Rust. It just brings together "exotic" features from lesser-known languages.
- Animats 10y agoI can't think of much real originality in Rust. It just brings together "exotic" features from lesser-known languages. I think you're right. Except for the borrow checker, which was a major breakthrough.
- tmccrmck 10y agoThe borrow checker is Cyclone's region-based memory management combined with linear/affine types. Edit: As an aside, I found a Reddit post the other day asserting that the Cyclone developers knew that it would never become mainstream but thought it was important because other languages would adopt it's ideas. It's amazing that they predicted that regions would be picked up later on by Rust. You can find it here: https://twitter.com/tmccrmck/status/850465514807631872 https://twitter.com/tmccrmck/status/850465514807631872
- parenthephobia 10y agoCompile-time checking of owned and borrowed references was in Vala, a C#-inspired language for the GNOME ecosystem, four years earlier.
- steveklabnik 10y agoDoesn't Vala use reference counting? [1] I'm not actually sure; do you have some pointers I could read here? 1: http://www.vala-project.org/doc/vala/Overview.html#Memory_management http://www.vala-project.org/doc/vala/Overview.html#Memory_ma...
- ssokolow 10y agoFrom what I remember, it just uses GLib's system for implementing reference-counted pointers in C and is equivalent to using Rc<T> or Arc<T> everywhere in Rust.
- steveklabnik 10y agoYeah, that's what I thought. Which is very different than most Rust code!
- parenthephobia 10y agoYes, but so does Rust. Reference counting is orthogonal to, although related to, to borrow checking. Vala's wiki has a page all about its ownership mechanism: https://wiki.gnome.org/Projects/Vala/Ownership https://wiki.gnome.org/Projects/Vala/Ownership
- steveklabnik 10y agoRust does not use reference counting for ownership, or borrow checking. It is true that you can introduce it for your own types though, with Rc/Arc. That's not really "rust using" it though; it's just a library. Thanks for the link, I'll dig in!
- fasquoika 10y agoThat's the point. IIRC it's called Rust to allude to the fact that there's nothing really new in the language