[fpc-devel] Functors

Sven Barth pascaldragon at googlemail.com
Thu May 26 21:59:15 CEST 2022


Am 26.12.2021 um 02:16 schrieb Blaise--- via fpc-devel:
> Important design points:
> 1) Applying round brackets to instances does not collide with the 
> existing syntax;
> 2) Naturally, helpers are able to turn helpees into functors;
> 3) Operator () cannot be applied to types -- that would clash with 
> explicit type conversions;
> 4) Explicit empty argument lists are required -- unorthogonal to 
> routines and procedural variables, but clarity must win here;
> 5) {$modeswitch Closures} is required (modeswitch_closures.patch from 
> https://lists.freepascal.org/pipermail/fpc-devel/2021-December/044261.html) 
> -- functors are closure-adjacent in the area of functional programming.
>
> The parts that are currently missing:
> 1) Implicit conversion from functors to method pointers -- should be 
> fairly trivial to implement;
> 2) Support for generics -- should be straightforward as well;
> 3) The OPERATOR keyword instead of PROCEDURE/FUNCTION for methods 
> Invoke -- should we choose to require it -- would be somewhat more 
> complicated.

Rejected. I've finally managed to integrate your support for function 
references, more is currently not required.

Regards,
Sven


More information about the fpc-devel mailing list