News for hackers. Stuff that matters.
Re:Such a Little Thing: The Semicolon in Rust by plaguuuuuu on Thursday October 18, 2012 @08:46PM (#4671762)
Is it just me or is this kind of ugly in the first place?

We're trying to mix logic that executes on each element in a sequence, with logic that controls how to iterate over that sequence. That is, a "return 42" statement will tell .each to stop iterating, but its contained within a block that is supposed to do things to individual elements.

The mathematical concept just doesn't sit right with me.. I guess if all you have as an iterator is 'each' then that would necessitate finding an additional way to modify iteration in some way, but still.. I don't like the fact that a return statement can break out of something outside of its own scope

edit: even the low-level alternative seems nicer

    for(blah;blah;blah) { 
        stuff;
    }

There are no comments on this comment yet.