[fpc-devel] Question about Syntax: I there a reason for this design?

Boian Mitov mitov at mitov.com
Mon Sep 22 20:26:05 CEST 2014


But it can be encapsulated in the anonymous object of anonymous method as it is done with local (stack) variables already in Delphi.
Anonymous methods can and do use local variables, and are regularly returned as result or passed to other threads.
That is the power of anonymous methods. I covered that in great detail in my last CodeRage session on functional programming.

With best regards,
Boian Mitov

-------------------------------------------------------
Mitov Software
www.mitov.com
-------------------------------------------------------

From: Michael Schnell 
Sent: Monday, September 22, 2014 1:54 AM
To: fpc-devel at lists.freepascal.org 
Subject: Re: [fpc-devel] Question about Syntax: I there a reason for this design?

On 09/21/2014 06:36 PM, Boian Mitov wrote:

  I consider it a design bug that local functions can’t be passed as anonymous methods in Delphi. There is no reason for that not to be done, except that they did not bother.

???
Local functions can use local variables of the outer function. Same are logically undefined outside the outer function and technically stack based. Hence  a local function can't be passed anywhere.

-Michael



--------------------------------------------------------------------------------
_______________________________________________
fpc-devel maillist  -  fpc-devel at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140922/76d3c4b6/attachment.html>


More information about the fpc-devel mailing list