13 ms·
Ownership in Swift: Manifesto and meta-proposal (2017)
- _delirium 3y agoThis proposal looks like it's from 2017 (there are more recent commits, but they are just typo fixes). It was briefly discussed here at the time: https://news.ycombinator.com/item?id=13669001 https://news.ycombinator.com/item?id=13669001 Anybody familiar with Swift development have updates on whether it went anywhere and what the current state is? As someone not in this particular loop, not immediately clear to me why a 6-year-old proposal was linked here.
- conradev 3y agoSwift 5.9 dropped at WWDC, and with it came with noncopyable value types: https://github.com/apple/swift-evolution/blob/main/proposals/0390-noncopyable-structs-and-enums.md https://github.com/apple/swift-evolution/blob/main/proposals... as well as a way to explicitly move types: https://github.com/apple/swift-evolution/blob/main/proposals/0366-move-function.md https://github.com/apple/swift-evolution/blob/main/proposals... I haven’t read either in-depth, though!
- adamwk 3y agoJust last week owning and borrowing parameters got accepted as well. https://github.com/apple/swift-evolution/blob/main/proposals/0377-parameter-ownership-modifiers.md https://github.com/apple/swift-evolution/blob/main/proposals... It’s been the focus for a while especially after the concurrency work. It’s probably the final major feature before Swift 6
- Someone 3y agoThe best description I know is https://www.hackingwithswift.com/articles/258/whats-new-in-swift-5-9 https://www.hackingwithswift.com/articles/258/whats-new-in-s..., which refers to a few Swift Evolution docs: https://github.com/apple/swift-evolution/blob/main/proposals/0377-parameter-ownership-modifiers.md https://github.com/apple/swift-evolution/blob/main/proposals... https://github.com/apple/swift-evolution/blob/main/proposals/0366-move-function.md https://github.com/apple/swift-evolution/blob/main/proposals... https://github.com/apple/swift-evolution/blob/main/proposals/0390-noncopyable-structs-and-enums.md https://github.com/apple/swift-evolution/blob/main/proposals... The first is explicitly marked as “Implementation: Swift 5.9, without no-implicit-copy constraint”, but it seems the others also ¿partly? are in.
- dang 3y agoYear added above. Thanks!
- 29athrowaway 3y agoFor current Rust users, if Rust kicks the bucket, Swift is a good plan B.
- AceJohnny2 3y agoI find it very notable that Graydon Hoare, the "founder" of Rust, went on to work at Apple on Swift for a while. Also, Swift had tremendous work to implement ABI stability[1], which really allows it to be used as an OS API, which Rust can't do. [1] https://faultlore.com/blah/swift-abi/ https://faultlore.com/blah/swift-abi/
- biorach 3y ago> which really allows it to be used as an OS API, which Rust can't do. I think that's a massive simplification
- ninkendo 3y agoIn what way? OS API’s can’t reasonably be copy/pasted into every binary on the system. It’s one thing to have large executables for third party apps you install, but you’d get tired of the wasted disk space really quickly if every binary in the OS had to statically link in the implementation of every library it used. It’s not just disk space either, but the ability for an OS as a platform to swap out implementations of their API’s with new ones, without requiring every app to be recompiled. It’s the reason macOS is able to implement things like dark mode, or a new UI theme, or any other “horizontal” feature that works across all apps; you need dynamic linking for that to be possible.
- duped 3y agoIt worked for Microsoft VC++ for a long time.
- pjmlp 3y agoNowadays they rely on COM for that purpose, which is nice as idea, if the tooling wasn't so clunky.
- armchairhacker 3y agoI can't wait for the day they add ownership semantics to JavaScript and Python.
- rahimnathwani 3y agoMojo aims to implement a superset of python, and supports ownership: https://docs.modular.com/mojo/programming-manual.html#argument-passing-control-and-memory-ownership https://docs.modular.com/mojo/programming-manual.html#argume... (same creator as Swift)