Proposal: overload conflict resolution
Rioshin an'Harthen
rharth75 at hotmail.com
Sun Dec 10 09:45:49 PST 2006
"Frits van Bommel" <fvbommel at REMwOVExCAPSs.nl> wrote:
> Chris Miller wrote:
>>
>> Strange example:
>> void bar(default char[] s, int x);
>> void bar(char[] s, default long x);
>
> I like the basic idea, but maybe it gets a bit to hairy when multiple
> parameters can have this attribute...
>
> 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.
So, we'd have something like
default void foo(char[] s);
void foo(wchar[] s);
void foo(dchar[] s);
with only one function of the same name at most with default...
I like this :). Votes++ for this modification.
More information about the Digitalmars-d
mailing list