Hacker News new | ask | show | jobs
by tptacek 4400 days ago
What are the distinctive features of Rust that Swift has that aren't in some way derived from ObjC? (I'm sure there are some; I just don't know Rust.)
4 comments

Nothing unique to rust.

The biggest thing I see is that it's an imperative language with functional-style ADT's, tuples, sum types, etc.

It also looks fairly similar syntactically (all those let's).

Not sure if there are other things it has in common.

To name a few: safety enforced at compile-time without any sort of GC/ARC (probably the biggest), more precise control over the hardware (e.g. more concrete pointers), the lack of a required runtime -- basically it has much better support for low-level features while not sacrificing many high-level features.
I believe tptacek was asking for the intersection of features between Swift and Rust, not for features that Rust has but Swift doesn't (like compile-time memory safety without GC/ARC).
Oh, you're totally right. Sorry, my parser is buggy!

Why couldn't he have just have written "(Swift ∖ ObjC) ∩ Rust"? :)

Protocols being used both as type parameter constraints and as types themselves reminded a few people of Rust's traits, but of course Rust didn't come up with those from whole cloth either.
I think graydon is reaching here, while there may be some intersection of features in Rust and Swift, I don't really see any Rust influence at all.