[fpc-devel] Blocks support

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jul 17 14:07:43 CEST 2014


On 17/07/14 12:48, Maciej Izak wrote:
 > Jonas Maebe wrote:
> >     type
> >        NSArrayEnumeratorBlock = procedure (obj: id; idx: NSUInteger; var
> >    stop: boolean) is block;
>
>
>
> What you think about more oxygene compatible syntax for blocks? :
>
> ***
> type
>    ClickEventDelegate = block (obj: id; idx: NSUInteger; var stop: boolean);
> ***
>
>   IMHO more readable :)
>
> http://www.elementswiki.com/en/Blocks

As mentioned in a previous mail, I'll go with the Delphi-derived syntax 
("reference to procedure (obj: id; idx: NSUInteger; var stop: boolean) 
is block; cdecl;").

The advantage of "... is block" over "block ..." would have been that it 
was consistent with the existing way to declare procedure variables for 
nested procvars ("... is nested"). I also don't think we have any 
syntactical elements taken from Oxygene yet, so let's not start making 
the language more complicated by mixing in things from even more sources 
in case one of the existing influences already has a syntax for it.


Jonas




More information about the fpc-devel mailing list