DMD 0.170 release
Reiner Pope
reiner.pope at REMOVE.THIS.gmail.com
Tue Oct 17 22:14:44 PDT 2006
Tom S wrote:
>
> I'm not yet fully convinced if trailing delegates should be allowed
> implicitly, just because a function's signature matches some criteria. A
> special keyword like 'trailing' could be used for it. Of course, because
> of a lack of a better keyword at the moment, we could just call it
> 'static' <g>
Versus plain old delegates, trailing delegates can allow:
1. type inference of parameters
2. syntactic sugar to remove ';' at the end, making it look more native
3. continue/break/return behaviour.
1 and 2 are syntactic sugar for the call-site; therefore, they should be
allowed implicitly.
3 is special behaviour and shouldn't be allowed implicitly. However, I
don't think a new keyword is required. Just make an enum:
enum IterationResult { CONTINUE, BREAK, RETURN };
and the break/continue behaviour is then only possible when the function
has a delegate as a second-last parameter, and IterationResult as the last.
Cheers,
Reiner
More information about the Digitalmars-d-announce
mailing list