[fpc-pascal] Passing nested procs out?

2018-11-15 Thread Ryan Joseph
Is passing nested procs outside of the calling scope relying on undefined behavior? It doesn’t seem like this should be allowed. === {$modeswitch nestedprocvars} program test; type TCallback = procedure (i: integer) is nested; function DoTest: TCallback; var

Re: [fpc-pascal] C-blocks

2018-11-15 Thread Sven Barth via fpc-pascal
Am Do., 15. Nov. 2018, 08:39 hat Ryan Joseph geschrieben: > > > > On Nov 15, 2018, at 1:27 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > They are only useful when interacting with the external runtime. On > other OSes nothing would support them thus there is no

Re: [fpc-pascal] Passing nested procs out?

2018-11-15 Thread Sven Barth via fpc-pascal
Am Do., 15. Nov. 2018, 10:17 hat Ryan Joseph geschrieben: > Is passing nested procs outside of the calling scope relying on undefined > behavior? It doesn’t seem like this should be allowed. > See the notes mentioned here: http://wiki.freepascal.org/FPC_New_Features_2.6.0#Support_for_nested_proc

Re: [fpc-pascal] Passing nested procs out?

2018-11-15 Thread Marcos Douglas B. Santos
On Thu, Nov 15, 2018 at 8:15 AM Sven Barth via fpc-pascal wrote: > > Am Do., 15. Nov. 2018, 10:17 hat Ryan Joseph > geschrieben: >> >> Is passing nested procs outside of the calling scope relying on undefined >> behavior? It doesn’t seem like this should be allowed. > > > See the notes mentione

Re: [fpc-pascal] Passing nested procs out?

2018-11-15 Thread Ryan Joseph
> On Nov 15, 2018, at 5:14 PM, Sven Barth via fpc-pascal > wrote: > > See the notes mentioned here: > http://wiki.freepascal.org/FPC_New_Features_2.6.0#Support_for_nested_procedure_variables > > Don't know if it is documented as such, but if not, it should be. > Sorry I’m not understandin

Re: [fpc-pascal] Passing nested procs out?

2018-11-15 Thread Sven Barth via fpc-pascal
Am Do., 15. Nov. 2018, 12:26 hat Marcos Douglas B. Santos geschrieben: > On Thu, Nov 15, 2018 at 8:15 AM Sven Barth via fpc-pascal > wrote: > > > > Am Do., 15. Nov. 2018, 10:17 hat Ryan Joseph > geschrieben: > >> > >> Is passing nested procs outside of the calling scope relying on > undefined b

Re: [fpc-pascal] Passing nested procs out?

2018-11-15 Thread Sven Barth via fpc-pascal
Am Do., 15. Nov. 2018, 12:40 hat Ryan Joseph geschrieben: > > > > On Nov 15, 2018, at 5:14 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > See the notes mentioned here: > http://wiki.freepascal.org/FPC_New_Features_2.6.0#Support_for_nested_procedure_variables > >

Re: [fpc-pascal] C-blocks

2018-11-15 Thread Ryan Joseph
> On Nov 15, 2018, at 5:09 PM, Sven Barth via fpc-pascal > wrote: > > Unlike you I'm in active contact with the developer and the last message was > only a few months ago. That’s good news then but I’m not going to hold my breath. Best of luck to the man. > > > Would it be permitted to

Re: [fpc-pascal] Passing nested procs out?

2018-11-15 Thread Ryan Joseph
> On Nov 15, 2018, at 8:24 PM, Sven Barth via fpc-pascal > wrote: > > The linked entry answers your question directly: > > "if you assign a nested routine to nested procedure variable and then exit > the nested routine's parent stack frame, calling the nested procedure > variable will resul

Re: [fpc-pascal] C-blocks

2018-11-15 Thread Sven Barth via fpc-pascal
Am Do., 15. Nov. 2018, 15:01 hat Ryan Joseph geschrieben: > Given that, having a light-weight “anonymous nested function” (not a > “reference to” closure) is actually a nice compliment and in fact 2 > different things. As FPC’s current c-blocks support demonstrates, it has > closure properties bu

Re: [fpc-pascal] C-blocks

2018-11-15 Thread Ryan Joseph
> On Nov 15, 2018, at 11:30 PM, Sven Barth via fpc-pascal > wrote: > > No, too many ways to do the same thing don't make things easier, not to > mention that everything needs to be maintained. So this gets a definite "no" > from me. > > Also the overhead for calling an anonymous function i