Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Ryan Joseph via fpc-pascal
> On Apr 27, 2021, at 9:58 AM, Michael Van Canneyt > wrote: > > Wait. > > I asked Sven to make sure that nested functions are under ALL circumstances > usable as closures or can be used instead of anonymous functions. > > Pas2js already supports this, and I want FPC and Pas2JS to be compatib

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Michael Van Canneyt via fpc-pascal
On Tue, 27 Apr 2021, Ryan Joseph via fpc-pascal wrote: On Apr 27, 2021, at 9:58 AM, Michael Van Canneyt wrote: Wait. I asked Sven to make sure that nested functions are under ALL circumstances usable as closures or can be used instead of anonymous functions. Pas2js already supports this

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Sven Barth via fpc-pascal
Am 27.04.2021 um 19:56 schrieb Michael Van Canneyt via fpc-pascal: On Tue, 27 Apr 2021, Ryan Joseph via fpc-pascal wrote: On Apr 27, 2021, at 9:58 AM, Michael Van Canneyt wrote: Wait. I asked Sven to make sure that nested functions are under ALL circumstances usable as closures or ca

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Ryan Joseph via fpc-pascal
> On Apr 27, 2021, at 2:17 PM, Sven Barth via fpc-pascal > wrote: > > It will *always* create an interface. It's just how the compiler will wrap it. But why would it do that when we could use an alternate code path that uses nested functions instead? Maybe I'm not being clear but we can do B

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Ryan Joseph via fpc-pascal
> On Apr 27, 2021, at 2:23 PM, Ryan Joseph wrote: > > But why would it do that when we could use an alternate code path that uses > nested functions instead? Maybe I'm not being clear but we can do BOTH > depending the situation when one is better than the other. This is just an > optimizati

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Graeme Geldenhuys via fpc-pascal
On 27/04/2021 10:13 pm, Ryan Joseph via fpc-pascal wrote: > value.SortEntities(function(a, b: TEntity): integer >begin > // do stuff >end > ); It seem the beginning of the thread is missing, but I would like to comment on something here - purely based on the exa

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Ryan Joseph via fpc-pascal
> On Apr 27, 2021, at 4:53 PM, Graeme Geldenhuys via fpc-pascal > wrote: > > Why must the anonymous function repeat all that information again, > as shown in the quoted code above? Can't the compiler figure all > that out simply by inference? All the developer should have to do > is give the 2

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-27 Thread Sven Barth via fpc-pascal
Am 28.04.2021 um 00:53 schrieb Graeme Geldenhuys via fpc-pascal: On 27/04/2021 10:13 pm, Ryan Joseph via fpc-pascal wrote: value.SortEntities(function(a, b: TEntity): integer begin // do stuff end ); It seem the beginning of the thread is missing, but I wou