[fpc-pascal] Re: Delphi's anonymous functions in Free Pascal
Marco van de Voort
marcov at stack.nl
Fri Oct 21 19:46:54 CEST 2011
The link below describes two uses for anonymous methods.
http://stackoverflow.com/questions/7818759/delphi-anonymus-methods-pro-and-cons-good-practices-when-using-closuresanony/7821882#comment9576663_7821882
I don't entirely subscribe to the (1) one, it seems to be mostly a shorthand
argument.
But (2) is somewhat logical and interesting. an. funcs allow to wrap a call
to a procedure together with its arguments inside a anonymous function
(closure-like) and queue that in a different thread and have it executed
there by RTL code.
I think that (2) is the main reason for anonymous functions, and people
shouldn't assume that the use of an. funcs is the same as in functional
languages. (IOW for expressions)
More information about the fpc-pascal
mailing list