Ary Borenszweig wrote:
If the compiler can transform a "foreach" into an opApply call, passing
the foreach body and converting breaks to "return 1" statements... can't
opApply be specified as:
int opApply(void delegate(ref uint) dg) { // note: delegate returns void
}
and the compiler transforms the opApply signature to the one that's used
now, plus converting each dg call to a call and a check of return value
!= 0 and return 1 in that case?
This only fails if you wish to take a particular action when the calling
code breaks out of iteration. This is not such a large use case that I
think it worth preserving.