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

2021-04-30 Thread Michael Van Canneyt via fpc-pascal
On Fri, 30 Apr 2021, Bo Berglund via fpc-pascal wrote: On Tue, 27 Apr 2021 10:52:28 -0600, Ryan Joseph via fpc-pascal wrote: On Apr 27, 2021, at 9:58 AM, Michael Van Canneyt wrote: Wait. Is this thread intentionally moved from fpc-devel? No. Mistake, due to mailing list settings

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

2021-04-30 Thread Bo Berglund via fpc-pascal
On Tue, 27 Apr 2021 10:52:28 -0600, Ryan Joseph via fpc-pascal wrote: > > >> On Apr 27, 2021, at 9:58 AM, Michael Van Canneyt >> wrote: >> >> Wait. Is this thread intentionally moved from fpc-devel? Seems to have started there but suddenly moved to general -- Bo Berglund Developer in

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

2021-04-29 Thread Ryan Joseph via fpc-pascal
> On Apr 29, 2021, at 12:01 AM, Sven Barth wrote: > > To be precise there are two more: function/procedure variables (no special > designator) and method variables ("of object"). Depending on what a anonymous > function captures (or for the sake of it a nested function) it would be >

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

2021-04-29 Thread Tomas Hajny via fpc-pascal
On 2021-04-29 09:00, Mattias Gaertner via fpc-pascal wrote: On Thu, 29 Apr 2021 07:52:19 +0200 Sven Barth via fpc-pascal wrote: [...] You completely ignored my first point, which in this case is the much more significant one: Pascal does not support type inference. FPC does not. Delphi

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

2021-04-29 Thread Graeme Geldenhuys via fpc-pascal
On 29/04/2021 8:00 am, Mattias Gaertner via fpc-pascal wrote: > FPC does not. > Delphi does: If only FPC would have strived to be Delphi Compatible. ;-) :-P Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

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

2021-04-29 Thread Mattias Gaertner via fpc-pascal
On Thu, 29 Apr 2021 07:52:19 +0200 Sven Barth via fpc-pascal wrote: >[...] > You completely ignored my first point, which in this case is the much > more significant one: Pascal does not support type inference. FPC does not. Delphi does:

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

2021-04-29 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mi., 28. Apr. 2021, 17:53: > > > > On Apr 27, 2021, at 11:36 PM, Sven Barth > wrote: > > > > Anyway, it would in principle be possible to convert an anonymous > function to a "is nested" function, but that will only come *after* the > whole implementation

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

2021-04-28 Thread Sven Barth via fpc-pascal
Martin Frb via fpc-pascal schrieb am Mi., 28. Apr. 2021, 19:26: > On 28/04/2021 18:43, Graeme Geldenhuys via fpc-pascal wrote: > > Hello Sven, > > > > On 28/04/2021 6:32 am, Sven Barth via fpc-pascal wrote: > >> Second: the syntax is required for Delphi compatibility anyway > > Couldn't such

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

2021-04-28 Thread Sven Barth via fpc-pascal
Graeme Geldenhuys via fpc-pascal schrieb am Mi., 28. Apr. 2021, 19:00: > Hello Sven, > > On 28/04/2021 6:32 am, Sven Barth via fpc-pascal wrote: > > Second: the syntax is required for Delphi compatibility anyway > > Couldn't such verbose syntax be limited to {$mode delphi} behaviour, > and then

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

2021-04-28 Thread Graeme Geldenhuys via fpc-pascal
On 28/04/2021 6:26 pm, Martin Frb via fpc-pascal wrote: > Would omitting the type info not lead to issues with overloaded functions? Luckily others have already solved that problem. :-) Here is Java's JSR-355 and overloading is covered in Section F.

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

2021-04-28 Thread Ryan Joseph via fpc-pascal
> On Apr 28, 2021, at 10:43 AM, Graeme Geldenhuys via fpc-pascal > wrote: > > Couldn't such verbose syntax be limited to {$mode delphi} behaviour, > and then leave {$mode objfpc} free to experiment and introduce new > less verbose syntax in the language. Sven is having none of this and for

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

2021-04-28 Thread Martin Frb via fpc-pascal
On 28/04/2021 18:43, Graeme Geldenhuys via fpc-pascal wrote: Hello Sven, On 28/04/2021 6:32 am, Sven Barth via fpc-pascal wrote: Second: the syntax is required for Delphi compatibility anyway Couldn't such verbose syntax be limited to {$mode delphi} behaviour, and then leave {$mode objfpc}

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

2021-04-28 Thread Graeme Geldenhuys via fpc-pascal
Hello Sven, On 28/04/2021 6:32 am, Sven Barth via fpc-pascal wrote: > Second: the syntax is required for Delphi compatibility anyway Couldn't such verbose syntax be limited to {$mode delphi} behaviour, and then leave {$mode objfpc} free to experiment and introduce new less verbose syntax in the

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

2021-04-28 Thread Ryan Joseph via fpc-pascal
> On Apr 27, 2021, at 11:36 PM, Sven Barth wrote: > > Anyway, it would in principle be possible to convert an anonymous function to > a "is nested" function, but that will only come *after* the whole > implementation is here so that the chance for messing that core functionality > (!) up is

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

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

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 >

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

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

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