2 ms·
The issue is that those keywords are expected to work a particular way, just like operators. Just like the operator + is expected to do some sort of addition op
by jdmichal 5y ago
The issue is that those keywords are expected to work a particular way, just like operators. Just like the operator + is expected to do some sort of addition operation, the keyword `break` is expected to do some sort of loop exit operation. The ability to reprogram the break operator to do anything else isn't useful for anything other than breaking expectations. And having to program the same break mechanics into every single iterable type rather than simply implementing an `Iterator` interface which then has those operators implemented seems less optimal.
Which is why I said, it seems like the only advantage is the ability to break expectations. Which is arguably, realistically a disadvantage.