Wow! That looks sweet. I Imagine this could be put to good use inside template constraints.. or so I think.<br><br>Thumbs up from me.<br><br><div class="gmail_quote">On Tue, Aug 10, 2010 at 6:40 AM, dsimcha <span dir="ltr"><<a href="mailto:dsimcha@yahoo.com">dsimcha@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">== Quote from Andrei Alexandrescu (<a href="mailto:SeeWebsiteForEmail@erdani.org">SeeWebsiteForEmail@erdani.org</a>)'s article<br>
<div><div></div><div class="h5">> Chris Williams wrote:<br>
> > I'm not sure whether the design of D 2.0 has stabilized as yet, but if not,<br>
> > I would like to suggest the ability to create custom block types.<br>
> [snip]<br>
> FWIW we've been talking a long time ago about a simple lowering - if the<br>
> last argument to a function is a delegate, allow moving the delegate's<br>
> body outside of the function:<br>
> fun(a, b, c) { body }<br>
> |<br>
> V<br>
> fun((a, b, c) { body });<br>
> As far as Walter and I could tell, there are no syntactical issues<br>
> created by such a lowering. But we've been wrong about that in the past<br>
> (me 10x more often than him).<br>
> Andrei<br>
<br>
</div></div>So this would basically allow the creation of custom flow control constructs at<br>
least to a limited extent? For example:<br>
<br>
void unless(T)(T condition, void delegate() executeThis) {<br>
if(!condition) executeThis();<br>
}<br>
<br>
void until(T)(T condition, void delegate() executeThis) {<br>
while(!condition) executeThis();<br>
}<br>
<br>
void main() {<br>
until(someoneKnowsWhetherPequalsNP() ) {<br>
writeln("Who knows?");<br>
}<br>
<br>
unless(P == NP) {<br>
writeln("P != NP");<br>
}<br>
}<br>
</blockquote></div><br>