3 ms·
What's the advantage of Swift over Rust if I'm looking at ditching C++ on a project that has nothing to do with Apple's ecosystem? Currently the top two commen
by ohazi 6y ago
What's the advantage of Swift over Rust if I'm looking at ditching C++ on a project that has nothing to do with Apple's ecosystem?
Currently the top two comments suggest that Swift looks compelling for this use case, but I don't really see it.
- potatochup 6y agoIf you don't need super-high performance it should in theory be easier to develop in swift as the automatic memory management is easier to deal with than rusts lifetimes/borrow checking. I tried them both out a few years ago, but gave up on swift because the cross-platform development story was poor. That's gotten better now it seems, but I'm already comfortable enough writing rust for everything I see no reason to switch.
- pornel 6y agoSwift is designed for making nice, concise, clever APIs. It favors convenient abstractions over raw performance. It's very well-suited for GUI applications (that's the #1 task it's been created for). That may extend to application back-ends that have lots of business logic, but don't need to process large amounts of data. This is in contrast to Rust, where more explicit memory management makes GUI frameworks a bit tedious. Rust is more explicit and gives lower-level of control, but borrow checking favors simple code over abstract interfaces. To me Swift is more like native TypeScript, and a more practical alternative to JavaScript and Python for app development. Rust is a more direct replacement for C++, because it offers similar level of performance and control over every byte in the program. Rust's compiler doesn't dare to insert any implicit allocations or non-trivial code itself, and will make programmer make every choice intentionally. Swift's compiler does whatever it takes to implement whatever abstraction it presents.