-
-
Save dherman/1609202 to your computer and use it in GitHub Desktop.
Mailbox.prototype.extractContents = function(contacts) { | |
let messages = this.messages; | |
loop: | |
for (let i = 0, n = messages.length; i < n; i++) { | |
messages[i].headers.forEach { |header| | |
if (header.isSpam()) | |
continue loop; // the label is not strictly necessary here | |
let addresses = header.extractAddresses(); | |
addresses.forEach { |addr| | |
contacts.add(addr.name, addr.email); | |
}; | |
}; | |
} | |
}; |
I commented more verbosely on Isaac's gist, but in short: what about disallowing mixing of block lambda return and normal return in a single function?
I just want to point out that this is what I mean about goto and FUD. Not that labels are true gotos, not that any form of goto is harmful. But that people will want to argue about it. We will be spending a lot of our time correcting people's misconceptions. And in the end, the consensus will be, "look just don't use labels, you don't need them if you know how to write good javascript". They are not a useful feature of javascript and they should be avoided. We've managed to do it for this long. Let's not falter now.
Yes I do realize that I'm the one that first mentioned goto. Call it a preliminary social experiment that served to fully support my hypothesis.
@dherman I've heard "block lambdas are a goto" as a nay argument before. (I agree with the "nay" bit of it, but not with the reasoning.) I'll respond to your comment about the other gist in the other gist's comments.