3 ms·
I don't think parent deserves to be modded down. The article did take a pretty long time to get to the point. Why all this talk about Python and Ruby? Rust i
by cmccabe 14y ago
I don't think parent deserves to be modded down. The article did take a pretty long time to get to the point.
Why all this talk about Python and Ruby? Rust is not really competing with those languages-- it is quite specifically designed as a C++ replacement. They should be comparing themselves against C++, Golang, or D.
The Golang solution would just be a function which returns the next element or nil if there are no more elements. That function might be part of an interface, if you wanted to generalize it across several types. To me, this is a lot simpler than the other stuff that was discussed.
To go back to Rust specifically, rather than having magic semicolons, why not make the "break" statement take a value, which becomes the return value of the block? Despite all the tl;dr there was not much discussion of design alternatives.