[fpc-pascal] [fpc-devel] Nested function closures

Sven Barth pascaldragon at googlemail.com
Thu Apr 29 07:54:54 CEST 2021


Martin Frb via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am Mi.,
28. Apr. 2021, 19:26:

> On 28/04/2021 18:43, Graeme Geldenhuys via fpc-pascal wrote:
> > Hello Sven,
> >
> > On 28/04/2021 6:32 am, Sven Barth via fpc-pascal wrote:
> >> Second: the syntax is required for Delphi compatibility anyway
> > Couldn't such verbose syntax be limited to {$mode delphi} behaviour,
> > and then leave {$mode objfpc} free to experiment and introduce new
> > less verbose syntax in the language.
>
> Would omitting the type info not lead to issues with overloaded functions?
>
> foo(function(a,b)
>
> Foo could have lots of overloaded arguments, all taking a callback with
> 2 params.
> Or it does not have them yet, but later.
>

It would have to derive the types from whatever is done inside the
anonymous function and even then that could lead to situations where the
parser would need to give up. I had already thought about such things as
well when I had played around (in my mind) with a slimmer lambda syntax.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210429/3ea84bf0/attachment.htm>


More information about the fpc-pascal mailing list