3 ms·
Not too often, yet. But it could potentially become a more user-friendly alternative to Rust.
by ajconway 7y ago
Not too often, yet. But it could potentially become a more user-friendly alternative to Rust.
- skohan 7y agoSwift seems to be evolving towards something which lives between Rust and Python.
- monoideism 7y agoI'd say more like something between Rust and Scala, or Rust and Java. That's not a bad thing. I really like Swift.
- monadic2 7y agoWhat rust features does it have?
- favorited 7y agoTo name a few: generics, pattern matching, memory safety by default (though not concurrent yet), no untyped-nil, the capability for C-like performance, deterministic memory management. Protocols are pretty similar to traits as well. Though the way all of those work is substantially different. Swift doesn't monomorphize generics like Rust does[0], for example. Swift doesn't have a concurrency story yet, so it is possible to have data races if you share data between threads. An ownership system[1] is in the works, but it is not complete yet. [0]https://www.reddit.com/r/rust/comments/7gkiie/implementing_swift_generics_video/dqkfkvh/ https://www.reddit.com/r/rust/comments/7gkiie/implementing_s... [1]https://github.com/apple/swift/blob/master/docs/OwnershipManifesto.md https://github.com/apple/swift/blob/master/docs/OwnershipMan...
- monoideism 7y agoGood summary. Also algebraic data types, although that typically accompanies the pattern matching you mentioned. Protocols are fairly close to traits, and I much prefer that approach (and Scala's traits), to traditional OOP.
- skohan 7y ago> Swift doesn't monomorphize generics like Rust does[0], for example. Swift can monomorphize generics, but it doesn't do so by default. Normally this is left up to the compiler, but it's possible to force monomorphization using inlining attributes.
- skohan 7y agoMe too. I think "higher level rust" is a very good and useful niche. Sometimes convenience is more important than performance.