[fpc-pascal] Operator overload resolution with arrays

Martok listbox at martoks-place.de
Mon Feb 5 15:00:31 CET 2018


>     Hi, I believe https://bugs.freepascal.org/view.php?id=27690
>     <https://bugs.freepascal.org/view.php?id=27690> is all about it.
Looks like it.

> IMHO this code shouldn't ever work. Any fix means really mess and hell and more
> problems.
Why? As the specialized interface gets "inserted" into the specializing unit at
that point, so should the implementation be - and at that point, the operator
*is* overloaded.
Instead, the overload has to be available in the implementation section of the
generic type, /unless/ it is a class or record. That seems odd. You know I
generally prefer consistency over obscure formal differences ;-)

And it's not like we don't already have absurd operator chains without that, see
31215.

> * use Generics.Collections
I'd like to stick with fcl units, and rtl-generics seems pretty outdated
compared to your repo?

Of course, the issue itself also occurs with any user code, not just containers.
That kind of lookup means *no* overload on non-object types is available to
generics declared in other units: arithmetic, Implicit, Explicit etc.


-- 
Regards,
Martok

Ceterum censeo b32079 esse sanandam.




More information about the fpc-pascal mailing list