[fpc-devel] C-block reference syntax (blocker for 3.2)
Jonas Maebe
jonas at freepascal.org
Sat Dec 7 10:28:32 CET 2019
On 2019-12-07 01:00, Blaise at blaise.ru wrote:
> 3) My first example back in 2016 intentionally featured a valid use
> case: CDECL is crucial for VARARGS. (Somehow, not only that case, but
> the whole point that DCC accepts calling conventions went unnoticed.)
I indeed did not know that.
> I wonder from where that desire to have the Delphi-like syntax for
> C-block references came.
It came from the facts that
1) afaik Delphi also allows you to pass plain methods (not sure about
plain procedures/functions though) to anonymous function parameters, so
inventing a new syntax seemed counterproductive
2) if, over time, someone would implement support for inline anonymous
functions (as you are doing now), that support could be added for
C-blocks as well without ending up with two different syntaxes for
semantically the same thing (just a different runtime/implementation
under the hood).
> If there is a consensus that this is a blocker, I am ready to do the
> work ASAP. provided we select the syntax. Personally, I am inclined
> towards these three:
> type M = procedure (const N: Integer) with var;
> type M = procedure (const N: Integer) cblock;
> type M = reference to procedure (const N: Integer) c;
I would prefer type M = reference to procedure (const N: Integer)
cblock;
It's weird that unlike with plain procvar type declarations, there's no
semicolon between the end of the signature and the calling convention
modifier though. Or is that merely a Delphi syntax thing?
Jonas
More information about the fpc-devel
mailing list