logoalt Hacker News

BobbyTables2last Saturday at 12:18 AM1 replyview on HN

Forget safety. Using enums in Rust is sheer delight. The fact they can even contain associated data is the really powerful. That alone makes me love the language. Especially with bitfields.

It cannot be matched in in C, even with a lot of macro magic. Plus, C is way too lax with type strictness and enums.


Replies

kstrauserlast Saturday at 4:06 AM

That’s right. And forget about the existing rustc compiler implement. If you have something in Rust like

  let a: HashMap = immutable_map.iter().map(…);
then you can infer from the semantics that the ordering doesn’t matter and whether it can be parallelized. C doesn’t have the ability to express what you want to happen, just how to do it. That gives Rust far more opportunity for optimization than C possibly can have.
show 1 reply