Proposal: overload conflict resolution

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sun Dec 10 10:46:49 PST 2006


Chris Miller wrote:
> On Sun, 10 Dec 2006 11:58:35 -0500, Frits van Bommel 
> <fvbommel at REMwOVExCAPSs.nl> wrote:
>> Maybe it should be an attribute of the function instead?
>> Then it becomes quite clear, I think: if there are multiple 
>> equally-good matches and among them the number of overloads with the 
>> attribute is anything other than one (that is, none or at least two) 
>> it's still an error, otherwise the one declared 'default' is picked.
> 
> I thought of it and generally agree it reduces complexity, but doesn't 
> give as much control. Consider one name that has overloads with many 
> different types, like toString; it has conflicts with numbers, strings, 
> and whatever else. Also consider when more than one parameter is 
> involved. I'm not sure which is the better tradeoff.

My version allows numbers and strings, as long as only one 'default' is 
in the overload set. Numbers and strings will never conflict, AFAIK.

When it comes to multiple parameters, what kind of use case did you have 
in mind?
I can't think of any at the moment, but that may just be my lack of 
imagination playing up again :).



More information about the Digitalmars-d mailing list