Am 24.02.2015 14:41 schrieb "Michael Schnell" <mschn...@lumino.de>: > > On 02/24/2015 11:32 AM, Mattias Gaertner wrote: >> >> About closures see for example: >> https://en.wikipedia.org/wiki/Closure_%28computer_programming%29 >> > Hence the "pure" closure paradigm does not need object-orientation. > > For my feeling it is prone to introduce some contradiction to object-orientation and maybe such a paradigm seems not very appropriate in an object language. > > Maybe a definition of a closure/anonymous-like construct with respect to objects might be invented, that auto-creates an instance of some object-type that inherits a "Closure" (or "Execute") procedure that automatically performs a free when returning.
Internally Closures are implemented as a class implementing an interface that provides an Invoke method. Also Object Pascal is not a pure object oriented language so I'm definitely not against non-OOP constructs. Keep also in kind though that languages like C# also have such constructs. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal