2 ms·
Swift's normal syntax is very nice and clean compared to Rust that needs to add ownership-related details. OTOH the way Swift proposes to add ownership-related
by pornel 5y ago
Swift's normal syntax is very nice and clean compared to Rust that needs to add ownership-related details.
OTOH the way Swift proposes to add ownership-related syntax is obviously a retrofit, and looks verbose. Rust had a syntax designed for ownership from the start. Swift needs extra syntax to first undo the ARC defaults, and then syntax to control the ownership. In this regard, Swift looks noisier.
Swift's `@nonescaping String` is `&str` in Rust. Swift's `arg: consuming Foo` is simply `arg: Foo` in Rust. Swift's `x = move(y)` is `x = y` in Rust.
From the point of view of semantics and functionality, it's all good. Swift's interaction with C was dangerous due to unobvious implicit rules of ARC. Having ability to get compiler-checked guarantees for lifetimes is very helpful.