4 ms·
I'm not too familiar with either Rust's or D's approach to lifetimes, but from some quick forum searching, it appears that adding Rust-like lifetimes to D would
by fasterik 3y ago
I'm not too familiar with either Rust's or D's approach to lifetimes, but from some quick forum searching, it appears that adding Rust-like lifetimes to D would have required significant changes to the design of the language. Every potential feature has tradeoffs in terms of how it interacts with other language features, adds cognitive overhead, decreases compilation speed, complicates the design of the standard library, breaks backward compatibility, etc. I don't think it's reasonable to expect a large-scale overhaul just to support one feature you like from another language.
- Conscat 3y agoGiven that Sean Baxter already has lifetimes in Circle that work very similarly to Rust's, I'm skeptical that the very similar D language wouldn't be able to express the same thing.
- tialaramex 3y agoGenerously, you've confused somebody saying they're interested in working on a problem with them having a working solution to the problem. Circle does not, in fact, have working Rust style lifetimes. Sean splits the Circle documentation into features which work and "Research" features Sean is working on and lots of interesting ideas, including lifetimes, are in the second category. Maybe Circle will implement them some day, or maybe it will not.
- steveklabnik 3y agoMy understanding is that he has been implementing them? I remember seeing screenshots like this go around back when I was on twitter: https://twitter.com/seanbax/status/1744403554155041047 https://twitter.com/seanbax/status/1744403554155041047 https://twitter.com/seanbax/status/1685671828767879168 https://twitter.com/seanbax/status/1685671828767879168
- Conscat 3y agoThey've been the primary focus of Circle for the better part of a year now. He's demo'd them working many times already.
- WalterBright 3y agoD's ownership/borrowing system does not require any language changes. It is opt-in at the function level to preserve compatibility with existing code. It does not break backward compatibility. It works as a prototype now, you can try it out. It does decrease compilation speed, because O/B requires data flow analysis. However, this is speed slowdown only happens for the functions marked as being O/B functions.