[fpc-pascal] Better way to handle callback types
Ryan Joseph
genericptr at gmail.com
Sat Aug 21 20:15:45 CEST 2021
> On Aug 21, 2021, at 12:08 PM, Jonas Maebe via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> You can pass global functions to "is nested" procvars, so at least these
> two don't need to be separate.
>
> OTOH, there's another type: cblocks :)
So up to 4 types are needed: "is nested", "of object" and "reference to" (for cblocks and eventually closures). Ouch.
This is certainly a mess and results in tons of boiler plate for functions that use callbacks. Shouldn't the compiler have a meta-type like I made? We should be able to write a single function which takes a callback and then have the compiler figure out which type is provided on the caller side.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list