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?
I.e.:

    operator := (x: integer): string;
    // with and without this more specific overload:
    procedure DoThis(msg:integer);overload;
    generic procedure DoThis<T>(msg:T);overload;

    DoThis(42);

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);
  DoThis(42);


-- 
Regards,
Martok


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to