4 ms·
You’re basically describing Swift. Swift and Rust had a ton of cross pollination during their early years which led to those features developing similarly but m
by hatuthecat 4y ago
You’re basically describing Swift. Swift and Rust had a ton of cross pollination during their early years which led to those features developing similarly but memory management is a lot less targeted for extreme efficiency like Rust. Hopefully as the language continues to mature, the feasibility to use it outside of apple platforms also does because I really enjoy the language design.
- noisy_boy 4y agoDoes Swift has pattern matching and equivalent of Option/Result enums? I tried it casually but the documentation didn't feel great and things felt like they assumed familiarity with Apple's ecosystem.
- valleyer 4y agoPatterns: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/patterns/ https://docs.swift.org/swift-book/documentation/the-swift-pr... Optionals: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/thebasics#Optionals https://docs.swift.org/swift-book/documentation/the-swift-pr... Result: https://developer.apple.com/documentation/swift/result https://developer.apple.com/documentation/swift/result
- runeks 4y agoSwift also supports enumerations with associates values, which is super useful: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/enumerations/#Associated-Values https://docs.swift.org/swift-book/documentation/the-swift-pr...
- noisy_boy 4y agoThanks for the links - I did the Swift Tour and the language has indeed come a long way since I tried it last time; quite expressive and nice to write in. Hopefully it gains traction in non-Apple circles as well.
- iainmerrick 4y agoI do really like Swift, but isn't it usually significantly slower than Rust? Swift seems more in the Go or Java class, rather than being competitive with C/C++ like Rust is. If that's so, Swift is still appealing as a pretty-fast, safe language with a much more sophisticated type system than Go or Java. But... TypeScript is too! I have a feeling in terms of raw performance, JS is probably closer to Swift than Swift is to Rust. The important difference between Swift and JS isn't performance as much as which platforms/APIs/languages they can integrate with. (Maybe I'm underestimating Swift's performance, though, or overestimating JS -- corrections welcome)
- bsaul 4y agoAgree. I feel like rust and swift will eventually converge with time, with swift providing more and more static guarantees and lifetime-related keyword, and rust improving its ergonomics. ( although recently swift definitely also went a completely different direction, adding as many concept as possible to the language)