<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=windows-1251"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
10.08.2010 9:19, Kagamin пишет:
<blockquote cite="mid:i3qng6$2clc$1@digitalmars.com" type="cite">
<pre wrap="">Andrei Alexandrescu Wrote:
</pre>
<blockquote type="cite">
<pre wrap="">FWIW we've been talking a long time ago about a simple lowering - if the
last argument to a function is a delegate, allow moving the delegate's
body outside of the function:
fun(a, b, c) { body }
|
V
fun((a, b, c) { body });
</pre>
</blockquote>
<pre wrap="">
I don't think, doOnce will work. Though, it's a useful idiom.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Filtered-With-Copfilter: Version 0.84beta4 (ProxSMTP 1.8)
Copfilter-Filtered-With: SpamAssassin 3.2.5
Copfilter-Virus-Scanned: ClamAV 0.94.2
by Markus Madlener @ <a class="moz-txt-link-freetext" href="http://www.copfilter.org">http://www.copfilter.org</a>
</pre>
</blockquote>
<pre wrap="">Maybe this one would:
block_template doOnce(string F = __FILE__, int L = __LINE__)() {
static bool hasRun = false;
if (!hasRun) {
hasRun = true;
$
}
}
or this one (with proposed lowering syntax):
void doOnce(string F = __FILE__, int L = __LINE__)(void delegate() dg)
{
static bool hasRun = false;
if (!hasRun) {
hasRun = true;
dg();
}
}
</pre>
<br>
<div class="moz-signature">-- <br>
<table style="border: 0px none; font-family: Segoe UI; font-size:
8pt;" width="100%">
<tbody>
<tr>
<td width="50%"><br>
</td>
<td><b></b>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>