Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-21 Thread Hairy Pixels via fpc-pascal
> On Apr 21, 2022, at 3:48 AM, Mattias Gaertner via fpc-pascal > wrote: > >> Writeln(Apply(@StrFunc, 'Foobar')); // will write FOOBAR >> Writeln(Apply(@NegFunc, 42)); // will write -42 >> end. > > Mind boggling. :) This was actually your idea if I remember correctly. :) I think you said even

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-21 Thread Michael Van Canneyt via fpc-pascal
On Thu, 21 Apr 2022, Hairy Pixels via fpc-pascal wrote: On Apr 21, 2022, at 3:48 AM, Mattias Gaertner via fpc-pascal wrote: Writeln(Apply(@StrFunc, 'Foobar')); // will write FOOBAR Writeln(Apply(@NegFunc, 42)); // will write -42 end. Mind boggling. :) This was actually your idea if

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-21 Thread Mattias Gaertner via fpc-pascal
On Thu, 21 Apr 2022 10:00:46 +0200 (CEST) Michael Van Canneyt via fpc-pascal wrote: > On Thu, 21 Apr 2022, Hairy Pixels via fpc-pascal wrote: > > > > > > >> On Apr 21, 2022, at 3:48 AM, Mattias Gaertner via fpc-pascal > >> wrote: > >>> Writeln(Apply(@StrFunc, 'Foobar')); // will write FOOBAR

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-21 Thread Hairy Pixels via fpc-pascal
If you want to pass a pointer to ^T in a generic function is there anyway safe to do this currently? Pascal doesn’t allow ^ types in function arguments (why?) and generics don’t seems to support pointers either (why?). generic TValues = array[0..0] of T; generic PValues = ^specialize TValues

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-21 Thread Hairy Pixels via fpc-pascal
> On Apr 20, 2022, at 1:15 PM, Sven Barth via fpc-pascal > wrote: > > Writeln(Apply(@StrFunc, 'Foobar')); // will write FOOBAR > Writeln(Apply(@NegFunc, 42)); // will write -42 For Sven, this reminds me, since we got this merged in now does that mean closures are ready? :D Regards,

Re: [fpc-pascal] Feature announcement: implicit generic function specializations

2022-04-21 Thread Michael Van Canneyt via fpc-pascal
On Fri, 22 Apr 2022, Hairy Pixels via fpc-pascal wrote: If you want to pass a pointer to ^T in a generic function is there anyway safe to do this currently? Pascal doesn’t allow ^ types in function arguments (why?) Because it is a type definition and you can't put type definition in a functi