Re: [fpc-pascal] Default record const values

2018-11-28 Thread Ryan Joseph
> On Nov 29, 2018, at 2:27 AM, Benjamin Rosseaux wrote: > > TTestHelper = record helper for TTest > public > const Default: TTest = (a: 1; b: 2); > end; I didn’t even know you could add consts to record helpers. That’s good to know, thanks. Multi scoped helpers will make this a safe

Re: [fpc-pascal] Constants in generics

2018-11-28 Thread Ryan Joseph
> On Nov 28, 2018, at 11:25 PM, Sven Barth via fpc-pascal > wrote: > > You're not wrong, but a type alias is definitely the wrong way. > But that is a completely different topic, one that I'm not willing to discuss > right now, aside from "we don't support something like that”. Ok, maybe so

Re: [fpc-pascal] Constants in generics

2018-11-28 Thread Ryan Joseph
> On Nov 29, 2018, at 5:15 AM, Sven Barth via fpc-pascal > wrote: > > Looks better. > The next thing to nuke is the tgenericparamdef. The parameters stored in > tdef.genericparas are the parameter symbols, so there should be no need for > defs. If necessary some of the code in pgenutil (and

Re: [fpc-pascal] Constants in generics

2018-11-28 Thread Sven Barth via fpc-pascal
Am 27.11.2018 um 11:35 schrieb Sven Barth: Am Di., 27. Nov. 2018, 08:18 hat Ryan Joseph mailto:r...@thealchemistguild.com>> geschrieben: > On Nov 27, 2018, at 4:59 AM, Sven Barth via fpc-pascal mailto:fpc-pascal@lists.freepascal.org>> wrote: > > Best check again once you've d

Re: [fpc-pascal] Default record const values

2018-11-28 Thread Benjamin Rosseaux
I'm using this solution myself for the vector and matrix data types at https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.pas https://github.com/BeRo1985/pasvulkan/blob/master/src/PasVulkan.Math.TpvVector2.Swizzle.Definitions.inc https://github.com/BeRo1985/pasvulkan/blob/master/

Re: [fpc-pascal] Default record const values

2018-11-28 Thread Sven Barth via fpc-pascal
Am 28.11.2018 um 20:27 schrieb Benjamin Rosseaux: program Test123; {$ifdef fpc}   {$mode delphi} {$endif} type   TTest = record   public     a: LongInt;     b: LongInt;   end;   TTestHelper = record helper for TTest   public     const Default: TTest = (a: 1; b: 2);   end; var   Test: TTest; be

Re: [fpc-pascal] Default record const values

2018-11-28 Thread Benjamin Rosseaux
program Test123; {$ifdef fpc} {$mode delphi} {$endif} type TTest = record public a: LongInt; b: LongInt; end; TTestHelper = record helper for TTest public const Default: TTest = (a: 1; b: 2); end; var Test: TTest; begin Test := TTest.Default; end. On Sat, Nov 10, 2

Re: [fpc-pascal] Constants in generics

2018-11-28 Thread Sven Barth via fpc-pascal
Am Mi., 28. Nov. 2018, 15:27 hat Ryan Joseph geschrieben: > > > > On Nov 28, 2018, at 7:26 PM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > Because that is not supposed to work. Generic routines are *routines*, > not types. You can't define aliases for routines ei

Re: [fpc-pascal] Constants in generics

2018-11-28 Thread Ryan Joseph
> On Nov 28, 2018, at 7:26 PM, Sven Barth via fpc-pascal > wrote: > > Because that is not supposed to work. Generic routines are *routines*, not > types. You can't define aliases for routines either, not to mention the > problems with scoping as generic methods exist as well. It seems natu

Re: [fpc-pascal] Constants in generics

2018-11-28 Thread Sven Barth via fpc-pascal
Am Mi., 28. Nov. 2018, 09:41 hat Ryan Joseph geschrieben: > I just noticed I sent this to the wrong person and the list never saw it > so I’m sending it again. I feel like I should try to fix it while I’ve got > my eyes on the generics code before I forget. > > Is there a reason it’s not implemen

Re: [fpc-pascal] Constants in generics

2018-11-28 Thread Ryan Joseph
> On Nov 27, 2018, at 11:07 PM, Sven Barth via fpc-pascal > wrote: > > Does it also work correctly if you change the constant and then recompile? > The same if the specialization is inside another unit used by the program? > It appears to work. I’ll make a proper test suite once we have th

Re: [fpc-pascal] Constants in generics

2018-11-28 Thread Ryan Joseph
I just noticed I sent this to the wrong person and the list never saw it so I’m sending it again. I feel like I should try to fix it while I’ve got my eyes on the generics code before I forget. Is there a reason it’s not implemented yet? In theory you should be able to specialize a function as