<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 04/03/2013 05:57, Alexander Klenin
wrote:<br>
</div>
<blockquote
cite="mid:CANjWPNvyHFkZwY+4019RgFo4hMGr6bZn=U77ZY668dnmXROBsA@mail.gmail.com"
type="cite">
<pre wrap="">On Mon, Mar 4, 2013 at 2:38 PM, Martin <a class="moz-txt-link-rfc2396E" href="mailto:lazarus@mfriebe.de"><lazarus@mfriebe.de></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Closures, do not need to be written/declared in the middle of other code
(in-line)
</pre>
</blockquote>
<pre wrap="">
Strictly speaking, they do not. However, if the closures are required
to be named,
their expressive power and readability will suffer greatly.
Nevertheless, I agree what the implementation plan can be detailed even further:
1) Anonymous procedures *without* closures -- basically, just another
syntax for nested procedures.</pre>
</blockquote>
That might be interested for mode Delphi<br>
<blockquote
cite="mid:CANjWPNvyHFkZwY+4019RgFo4hMGr6bZn=U77ZY668dnmXROBsA@mail.gmail.com"
type="cite">
<pre wrap="">2) Named closures support -- while I do think that anonymous
procedures are useful,</pre>
</blockquote>
And this could be in mode FPC too. So "purists" can still enjoy
closures. But it keeps one of the thinks that make Pascal:
Declaration is all done before the code block starts.<br>
<br>
<blockquote
cite="mid:CANjWPNvyHFkZwY+4019RgFo4hMGr6bZn=U77ZY668dnmXROBsA@mail.gmail.com"
type="cite">
<pre wrap="">
3) Anonymous closures support -- a combination of the above:
// Delphi-compatible syntax. Could be made to *not* use closures in
4) As stated above, either a syntax to explicitly turn off a closure
for anonymous procedure,
or intelligent enough optimizer to do that automatically. I have
some ideas on both fronts,
but I suggest we first discuss previous points.
</pre>
</blockquote>
<br>
IMHO explicit Syntax.<br>
<br>
But in the recent light of discussions to keep pascal being Pascal,
anonymous functions could be entirely mode delphi only.<br>
<br>
From the reasons for anonymous methods.<br>
<blockquote type="cite">
<pre wrap=""> in Delphi every local variable access becomes a reference to the
frame object field,
<b class="moz-txt-star"><span class="moz-txt-tag">*</span>even in the parent procedure<span class="moz-txt-tag">*</span></b>. So "nested" anonymous procedures,
together with
good inlining support, are crucial for the efficient implementation
of, for example,
various "ForEach" methods.</pre>
</blockquote>
<br>
That could be implemented for *named* closures too, and then there
was no need for the anonymous.<br>
<br>
<br>
IMHO anonymous methods are a syntactical difference only. All
functionality can be done with named equivalents too.<br>
<br>
<br>
</body>
</html>