[fpc-devel] Syntax choice (was: Blocks support)
skalogryz.lists at gmail.com
Sun Jul 20 22:27:04 CEST 2014
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
In general "reference to" seems like a poor choice made by Embarcadero (and
FPC has to follow).
* using "in block" seems more reasonable and more consistent with pascal
"postfix" or "suffix" functions declarations in general.
* name "reference to" somewhat overlaps with "^" syntax. Which is also
named "reference to".
Is it planned to use explicit term "C-block" (or "Apple-block") for the
feature. To avoid conflicts with pascal declaration blocks
On Fri, Jul 18, 2014 at 5:20 AM, Jonas Maebe <jonas.maebe at elis.ugent.be>
> On 16/07/14 14:12, Jonas Maebe wrote:
> I've (locally, not yet in svn) implemented support for blocks in FPC (
>> http://en.wikipedia.org/wiki/Blocks_(C_language_extension) ).
> 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:
> NSArrayEnumeratorBlock = reference to procedure (obj: id; idx:
> NSUInteger; var stop: boolean); cdecl;
> 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").
> 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.
> Mac-Pascal mailing list
> Mac-Pascal at lists.sonic.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel