3 ms·
What rust features does it have?
by monadic2 7y ago
What 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.