<div dir="ltr"><div>Hello,<br><br>I was curious about the proposed syntax option, why "in block" rather than just "block"? There's no "block" reserved word in FPC yet (unlike mentioned earlier Oxygen).<br>
</div><div><br></div><div>In general "reference to" seems like a poor choice made by Embarcadero (and FPC has to follow). <br>* using "in block" seems more reasonable and more consistent with pascal "postfix" or "suffix" functions declarations in general. <br>
</div><div>* name "reference to" somewhat overlaps with "^" syntax. Which is also named "reference to".<br></div><div><br></div><div>Is it planned to use explicit term "C-block" (or "Apple-block") for the feature. To avoid conflicts with pascal declaration blocks <a href="http://www.freepascal.org/docs-html/ref/refse98.html">http://www.freepascal.org/docs-html/ref/refse98.html</a><br>
</div><div><br></div>thanks,<br>Dmitry<br><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 18, 2014 at 5:20 AM, Jonas Maebe <span dir="ltr"><<a href="mailto:jonas.maebe@elis.ugent.be" target="_blank">jonas.maebe@elis.ugent.be</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">On 16/07/14 14:12, Jonas Maebe wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I've (locally, not yet in svn) implemented support for blocks in FPC (<br>
<a href="http://en.wikipedia.org/wiki/Blocks_(C_language_extension)" target="_blank">http://en.wikipedia.org/wiki/<u></u>Blocks_(C_language_extension)</a> ).<br>
</blockquote>
<br></div>
I've now committed the initial implementation in the blocks branch on svn. As discussed on the fpc-devel list, the syntax has been changed to:<br>
<br>
type<br>
  NSArrayEnumeratorBlock = reference to procedure (obj: id; idx: NSUInteger; var stop: boolean); cdecl;<br>
<br>
The reason is that Delphi already introduced the "reference to" syntax for anonymous functions in Pascal. The extra "cdecl;" indicates that it's the C-variant of an anonymous function (i.e., a "block").<br>

<br>
Apart from supporting global routines, the current implementation also already supports assigning the address of a method of a Pascal class/object to a block variable (or passing it to a block parameter). Nested functions/procedures are not yet supported.<br>

<br>
<br>
Jonas<br>
______________________________<u></u>_________________<br>
Mac-Pascal mailing list<br>
<a href="mailto:Mac-Pascal@lists.sonic.net" target="_blank">Mac-Pascal@lists.sonic.net</a><br>
<a href="https://lists.sonic.net/mailman/listinfo/mac-pascal" target="_blank">https://lists.sonic.net/<u></u>mailman/listinfo/mac-pascal</a><br>
</blockquote></div><br></div></div></div></div>