Re:Linus Torvalds: Rust for the Kernel Could Possibly Be Mer...
by dgb23 on Thursday June 23, 2022 @11:51AM
(#31850854)
For and while have different semantics. For is not just sugar for a while loop, it means something more specific and restricted than a general while.
[ Parent
| on HN ]
Re:Linus Torvalds: Rust for the Kernel Could Possibly Be Mer...
by jeffparsons on Thursday June 23, 2022 @12:03PM
(#31851022)
For _is_ "just sugar for a while loop". In fact, here's the Rust documentation detailing what a `for` loop "de-sugars" down to: http://doc.rust-lang.org/nightly/std/iter/#for-loops-and-int...
> it means something more specific and restricted than a general while
Sure, but that's still sugar. That's what sugar is.
Want to know something really crazy? In Rust, the `if` keyword is also just syntactic sugar over `match`. Still finding bits of grey matter on the walls from when I learned that one.