On Mon, 23 Oct 2017, Ryan Joseph wrote:
On Oct 23, 2017, at 8:55 PM, Mattias Gaertner <nc-gaert...@netcologne.de> wrote: program test1; {$mode objfpc}{$H+} {$ModeSwitch nestedprocvars} type TCallback = procedure (a: integer) is nested; procedure DoCallback; procedure DoThis(a: integer); begin writeln(a); end; var callback: TCallback; begin callback := @DoThis; callback(100); end; begin DoCallback; end. Keep in mind what Sven wrote. You cannot use "callback" outside of DoCallBack, because FPC does not yet support Delphi's "reference to".Thanks, I never heard of nestedprocvars. Why isn’t that the default? If I have a callback I may have it be nested or not so I always want “is nested” on I guess.
It is not the default because neither Delphi nor TP allow this. Macpas mode enables it, since it was allowed in MWP. Michael.
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal