4 ms·
I completely agree. I currently use Rust for all my cross platform use-cases. I'd love to have the same kind of library ecosystem ("crates") with Swift that I g
by terhechte 7y ago
I completely agree. I currently use Rust for all my cross platform use-cases. I'd love to have the same kind of library ecosystem ("crates") with Swift that I get with Rust. I hope we will get there slowly, with this and now that Windows almost works.
- mlevental 7y agoi use rust too and some of the quality of life features from swift would make rust as good as swift, if not better. ?? rather than unwrap_or, as? and try?, if let, guard let. maybe there are reasons rust didn't incorporate this sugar having to do with the borrow checker i don't know but jeez i feel so burdened with boiler plate when i deal with optionals in rust.
- sanxiyn 7y agoRust has if let. It can't chain them yet, but the proposal to fix it (RFC 2497) was accepted and implementation is in progress.
- terhechte 7y agoBut Rust lacks `guard let x = a else { return }` which is one of the nicest additions of Swift. I know there were attempts to add it to Rust, but somehow the community really doesn't like it because a `let x = match a { Some(a) => a, None => return; }` is too similar. However I feel that guard also expresses the intent.
- gamegoblin 7y agoI frequently define a `guard!` macro in Rust that does exactly that. Seems clean enough to solve at the macro level -- doesn't necessarily need to be built into the language itself.
- newacctjhro 7y agoThis kind of stuff should be on the stdlib if it's meant to be idiomatic.
- gamegoblin 7y agoRust errs on the side of not putting things in the stdlib. Even things like random number generation or regexes are not in stdlib. The excellent package manager (Cargo) makes this a non-issue.
- Klonoar 7y agoAs a contrary view, I find the boilerplate helps when I revisit a Rust project months later.
- totalperspectiv 7y agoIf you'd like a lower friction yet similar speed / systems language. I'd highly recommend playing around with Nim. It is exceedingly pleasant and easy to use.