3 ms·
Most of the video describes a system similar to Swift, where function arguments can be borrowed or inout, but borrowed references are not first-class types, and
by comex 2y ago
Most of the video describes a system similar to Swift, where function arguments can be borrowed or inout, but borrowed references are not first-class types, and so you don't have lifetimes like in Rust. In Swift, this design definitely makes the language more approachable than Rust, but it results in a ton of unnecessary refcounting and sub-objects forced to be their own heap allocations, which contributes to Swift's reputation for terrible performance overall.
But then, at the end of the video, Chris says that Mojo has lifetimes! …But leaves an explanation for a future video.
So I'm looking forward to that.
- raphlinus 2y agoUntil that video comes out, you can read the proposal[1]. This appears to be quite recent (the timestamp says 4 days ago). I personally found the writing style of the proposal to be clearer than the tutorial-flavor of the original blog post (I haven't watched the video). But that's probably because I have a programming language background and am intimately familiar with Rust. [1]: https://github.com/modularml/mojo/blob/main/proposals/lifetimes-and-provenance.md https://github.com/modularml/mojo/blob/main/proposals/lifeti...
- adamwk 2y agoSwift's ownership features are still new and going through evolutions; so its current state isn't the necessarily the vision or where it will be in a year. E.g., here's a proposal that allows one to create a lifetime dependency between a function's return value and its parameters: https://github.com/apple/swift-evolution/blob/d9aa90bae13e353423b1105901d47d3907d7c021/proposals/NNNN-lifetime-dependency.md https://github.com/apple/swift-evolution/blob/d9aa90bae13e35...
- comex 2y agoWell, that's very interesting indeed. Maybe there's hope for Swift in the future.