[fpc-pascal] Implicit generic specializations
listbox at martoks-place.de
Mon Dec 3 15:10:16 CET 2018
Am 03.12.2018 um 14:01 schrieb Ryan Joseph:
> I believe I managed to solve the problem and now non-generic procedures take precedence. I guess it’s possible that you could opt out of an implicit specialization now but declaring and overload which the specific type you were interested in. This is probably a good fallback to have so it’s good it’s like this now.
What happens when there are implicit conversion operators defined?
operator := (x: integer): string;
// with and without this more specific overload:
generic procedure DoThis<T>(msg:T);overload;
I'd normally say it should take the integer one (or specialize using integer)
and ignore the overloads, but now that I think about it, overloads should be
checked if they are required to satisfy type constraints on the generic, such as:
operator :=(x: integer): TObject; // whatever that might do
generic procedure DoThis<T: class>(inst: T);
More information about the fpc-pascal