Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-30 Thread Bart via fpc-pascal
On Mon, May 30, 2022 at 7:25 AM Sven Barth via fpc-pascal wrote: > === code begin === > > Sort(lamba (left, right) as > if left < right then -1 > else if left > right then 1 > else 0); > This doesn't look like Pascal at all. I definitively hope this is not the future of our beautiful langu

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-29 Thread Sven Barth via fpc-pascal
Am 28.05.2022 um 14:04 schrieb Benito van der Zander via fpc-pascal: Hi, Sort((left, right) begin if left < right then result := -1 else if left > right then result := 1 else

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-28 Thread Thomas Kurz via fpc-pascal
ascal@lists.freepascal.org Sent: Saturday, May 28, 2022, 14:04:46 Subject: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions Hi, > Sort((left, right) begin > if left < right then >result := -1 >

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-28 Thread Hairy Pixels via fpc-pascal
> On May 27, 2022, at 6:31 PM, Marco van de Voort via fpc-pascal > wrote: > > Ditto! https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39774 > > This ticket also contains an experimental patch for anonymous method queue > and synchronize. (required to reproduce) Yeah code tools is

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-28 Thread Hairy Pixels via fpc-pascal
> On May 28, 2022, at 7:04 PM, Benito van der Zander via fpc-pascal > wrote: > > The "result" variable is also ugly. You could make "if" an expression: > > Sort( @(left, right) begin > result := > if left < right then -1 > else

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-28 Thread Hairy Pixels via fpc-pascal
> On May 28, 2022, at 6:39 PM, Michael Van Canneyt via fpc-pascal > wrote: > > And I'm sure it finds these very understandable (live examples): > > [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: > any) => void) => void) & {only: any, skip: any}; > load: (url: stri

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-28 Thread Benito van der Zander via fpc-pascal
Hi, Sort((left, right) begin if left < right then result := -1 else if left > right then result := 1 else result := 0; end); One could introduc

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-28 Thread Michael Van Canneyt via fpc-pascal
On Sat, 28 May 2022, Hairy Pixels via fpc-pascal wrote: On May 28, 2022, at 2:06 PM, Michael Van Canneyt via fpc-pascal wrote: Ah... The desire to make a programming language terse and unreadable as a consequence. If you want that, use C#, Javascript or one of the ubiquitous languages f

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-28 Thread Hairy Pixels via fpc-pascal
> On May 28, 2022, at 2:06 PM, Michael Van Canneyt via fpc-pascal > wrote: > > Ah... > > The desire to make a programming language terse and unreadable as a > consequence. > If you want that, use C#, Javascript or one of the ubiquitous languages for > bracket fetishists. > Scala & Rust top

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-28 Thread Michael Van Canneyt via fpc-pascal
On Sat, 28 May 2022, Hairy Pixels via fpc-pascal wrote: I’ve had some time to play with this now and my first piece of feedback is that given my experience with other languages, the most common usage of closures is by passing them as arguments to functions. Compared to the other languages I

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-27 Thread Hairy Pixels via fpc-pascal
I’ve had some time to play with this now and my first piece of feedback is that given my experience with other languages, the most common usage of closures is by passing them as arguments to functions. Compared to the other languages I’m using now I’d say that we should be inferring more of the

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-27 Thread Ondrej Pokorny via fpc-pascal
On 27.05.2022 00:23, Zoë Peterson via fpc-pascal wrote: Sven, I'm absolutely thrilled to see this finally merged.  I sincerely appreciate all of the work that you and Blaise put into it over such a long time.  I can't wait to see what the community is able to do with it.  Thank you, and thank

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-27 Thread Marco van de Voort via fpc-pascal
On 27-5-2022 14:12, Sven Barth via fpc-pascal wrote: You couldn't have written a test that's independent of TThread? 🥺 When I saw no reactions on core this morning, I dumped everything I had to the respective issue trackers. I'm not sure if I can get all of this reproduced on my private laptop

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-27 Thread Sven Barth via fpc-pascal
Marco van de Voort via fpc-pascal schrieb am Fr., 27. Mai 2022, 13:31: > > On 27-5-2022 00:46, Mattias Gaertner via fpc-pascal wrote: > > > >> As these two features are rather complicated there might still be a > >> huge bundle of bugs lurking around so I ask you to test them to year > >> heart's

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-27 Thread Marco van de Voort via fpc-pascal
On 27-5-2022 00:46, Mattias Gaertner via fpc-pascal wrote: As these two features are rather complicated there might still be a huge bundle of bugs lurking around so I ask you to test them to year heart's content and report found bugs First! Ditto! https://gitlab.com/freepascal.org/lazarus/

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-26 Thread Sven Barth via fpc-pascal
Am 27.05.2022 um 00:46 schrieb Mattias Gaertner via fpc-pascal: On Thu, 26 May 2022 21:47:06 +0200 Sven Barth via fpc-pascal wrote: As these two features are rather complicated there might still be a huge bundle of bugs lurking around so I ask you to test them to year heart's content and report

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-26 Thread Hairy Pixels via fpc-pascal
> On May 27, 2022, at 2:47 AM, Sven Barth via fpc-pascal > wrote: > > Further RTL enhancements like the declaration of TProc<> or the addition of a > TThread.Queue() that takes a function reference will come in the near future > now that the basics on the compiler side are done. Maybe we can

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-26 Thread Thomas Kurz via fpc-pascal
Great!!! Thank you very very much :))) - Original Message - From: Sven Barth via fpc-pascal To: fpc-annou...@lists.freepascal.org Sent: Thursday, May 26, 2022, 21:47:06 Subject: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions Dear Free Pascal Community

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-26 Thread Mattias Gaertner via fpc-pascal
On Thu, 26 May 2022 21:47:06 +0200 Sven Barth via fpc-pascal wrote: >[...] > The Free Pascal Developer team is pleased to finally announce the > addition of a long awaited feature, though to be precise it's two > different, but very much related features: Function References and > Anonymous Fu

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-26 Thread Zoë Peterson via fpc-pascal
Sven, I'm absolutely thrilled to see this finally merged.  I sincerely appreciate all of the work that you and Blaise put into it over such a long time.  I can't wait to see what the community is able to do with it.  Thank you, and thank you to the entire Free Pascal team for everything you'v

Re: [fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-26 Thread Michael Van Canneyt via fpc-pascal
Hello ! Nice job, kudos both for Blaise and Sven, and special thanks to Zoë Peterson for donating the code to FPC, as Scooter Software sponsored the initial work by Blaise. I'm glad to see that the FPC implementation makes the distinction between function references and anonymous functions ve

[fpc-pascal] Feature Announcement: Function References and Anonymous Functions

2022-05-26 Thread Sven Barth via fpc-pascal
Dear Free Pascal Community, The Free Pascal Developer team is pleased to finally announce the addition of a long awaited feature, though to be precise it's two different, but very much related features: Function References and Anonymous Functions. These two features can be used independantly o