[fpc-devel] specialization with type alias, bug or feature
Mattias Gaertner
nc-gaertnma at netcologne.de
Tue Oct 10 20:39:46 CEST 2023
On 18.08.23 00:09, Mattias Gaertner via fpc-devel wrote:
>[...]
Another point where it could wrong, is a generic method.
For example:
type
TBird<T> = class
procedure Fly<S>; // fpc does not yet allow this
end;
var
a: TBird<double>;
b: TBird<TDateTime>;
begin
a:=b;
a.Fly<word>; // this might call the wrong specialization or even call
a non existing method
end;
So with class vars, generic methods and sub types the assignment must be
forbidden.
Maybe pas2js could allow it for simple arrays, pointers, records and
classes.
Mattias
More information about the fpc-devel
mailing list