Re:Rust for functional programmers
by kzrdude on Sunday July 13, 2014 @01:12PM
(#8027938)
What the for loop actually expands to is much easier to read.
[ Parent
| on HN ]
It doesn't actually expand to that any more. You can see what it does expand to by running rustc --pretty expanded with a recent compiler:
for pattern in iterator {
body
}
becomes match &mut iterator {
i => loop {
match i.next() {
None => break ,
Some(mut _value) => { let pattern = _value; { body } }
}
}
}Much easier to read to who? Not to me at least.
Code readability is subjective and depends on experience and familiarity.