In C++ duck typing there is the concept of a callable, e.g. a symbol that can be called like a function. I'd like to emulate this with Delphi generics.
I have a problem where I need a procedure that can accept either a normal procedure, a class method or a lambda as argument. Right now I have 3 almost identical overloaded implementations. Is there a way to use Delphi generics to avoid this duplication?