Re: [fpc-pascal] Generic type conflicts

2019-11-02 Thread Ryan Joseph via fpc-pascal
> On Nov 2, 2019, at 11:06 AM, Cyrax via fpc-pascal > wrote: > > You need to do a explicit typecasting. > > ... > fac:=Sqrt(Sqr(TScalar(x)) + Sqr(TScalar(y))); > ... > fac:=1.0/TScalar(fac); Doesn't work. Try running the example. Regards, Ryan Joseph ___

Re: [fpc-pascal] Generic type conflicts

2019-11-02 Thread Cyrax via fpc-pascal
On 02/11/2019 16:55, Ryan Joseph via fpc-pascal wrote: I've wanted to make a generic version of a vector for a while but I always give up because it seems not very possible. It's probably not even a great idea because many methods don't translate between float and integer but I wanted to preve

[fpc-pascal] Generic type conflicts

2019-11-02 Thread Ryan Joseph via fpc-pascal
I've wanted to make a generic version of a vector for a while but I always give up because it seems not very possible. It's probably not even a great idea because many methods don't translate between float and integer but I wanted to prevent other code duplication if possible. Here's an example

[fpc-pascal] Generic operator overload problem

2019-11-02 Thread Ryan Joseph via fpc-pascal
Is this a bug or did I do something wrong? The minus operator overload seems to be getting confused and I get a "Can't determine which overloaded function to call" error as a result. {$mode objfpc} {$modeswitch advancedrecords} program generic_vector; uses Math; type generic TVec2 = record