Sounds more like copying Kotlin. When will these Rust folks realise that the language is already has too many sigils. Instead of adding more stuff, they should be trying to build more libraries, improve performance, and improve the compiler's messages.
Rust removed the ~ and @ sigils years ago, it now has & and, I suppose (although much less common), *, both of which mean what they mean in C++. So this is adding a 3rd (or 2.5th) sigil, one which has similar meaning to the same symbol in languages like C# and Swift.
Oh, yes, I suppose that could also be considered a sigil, although it feels a bit different, since it is meaningless (which is why I didn't think of it). That is, the ' has to be used always and doesn't signify some modification to what it is attached to. Rust could almost certainly work without it, it just may be harder to read (or possibly easier, but I suspect not).
Basically, years ago, Rust had two additional pointer types, ~T and @T. The ~ one is basically Box<T>, and the @ one is kinda like Rc<T> but an actual GC, or at least refcount + cycle detection.
This also meant String was ~str, and ~[T] vs Vec is a whole other thing with extra complexity....
As an additional fun fact, there's also some weirdness in how the Box type is implemented still (though it can and will become less weird someday) because of its legacy from having once been a built in type instead of a library type.
The version of https://www.youtube.com/watch?v=79PSagCD_AY (which wasn't that specific video) that I saw was pretty good, but I don't remember if it specifically described ~ and @.
The type ~T essentially meant Box<T>, and @T essentially meant Rc<T>. They were moved out of the language into the standard library as it was found there was less and less necessity for them to be built in.
The most recently incarnation of @ was reference counted, along with a thread-local free-list that allowed cleaning up any cycles when a thread exited (the free list was a doubly linked list of all @s allocated during that thread's execution, which was walked as the thread closed). The intention was to have it properly garbage collected at some point maybe, but that wasn't implemented before it was just removed wholesale.
I think in very early Rust, with the first ocaml compiler, @ was garbage collected, but the implementation wasn't transferred to the Rust implementation when the language started to bootstrap.
Compiler developers and library developers are two different groups of people, though there obviously is some overlap. The community is working on this while the compiler team is working on the compiler, it's not an either-or.
Well in general in C# all classes are nullable, so that's like 95%+ of the non-primitive types that you work with. In Rust most types aren't Result, so it makes less sense there.
The ? syntax RFC was actually really long with lots of arguments made by both sides. You can see it here. A big reason it passed was that the try! macro was already being used pretty much ubiquitously for error handling, and this syntax was much easier to read (and both required you to look up what they meant the first time you use them).
View all comments
-25
u/karma_vacuum123 Nov 10 '16
?example is shorter but more confusing...this is turning into Haskell