even more delegate sugar
Tom S
h3r3tic at remove.mat.uni.torun.pl
Tue Aug 22 06:53:24 PDT 2006
Don Clugston wrote:
> Oskar Linde wrote:
>> Don Clugston wrote:
>>> On reflection, an even more interesting example is variants of
>>> foreach, which I think would become completely redundant.
>>
>> break would pose a problem though.
>
> You're right.
> Although foreach with opApply has the same problem.
Umm, nope...
http://digitalmars.com/d/statement.html#foreach
Look at the opApply example. The delegate implementing foreach's body
returns != 0 in case of a break.
It can be emulated thru e.g.
return BREAK;
or
return CONTINUE;
but if there was a way to define a function like:
outer.return myBreak() {
outer.return BREAK;
}
... then things could get even more bizarre ;)
More information about the Digitalmars-d
mailing list