August 24, 2006
BCS wrote:
> Bruno Medeiros wrote:
>> Walter Bright wrote:
>>
>>> It just gives an ambiguity error at compile time.
>>
>>
>> Why not (just as the in-out-inout case) give an error when the overloads are defined, instead of just when calling? Because if one will not be able to call the char[] version then it might as well be an error right then.
> 
> IIRC the in-out-inout case can't be done at the declaration, same goes for other overloads
> 
> <code name="a.d">
> void foo(in char);
> </code>
> 
> <code name="b.d">
> void foo(out char);
> </code>
> 
> <code>
> import a;
> import b;
> ....
> char c;
> a.foo(c);  //ok
> b.foo(c);  //ok
> foo(c);    //error
> </code>
> 
> 
> <code>
> import a;
> ....
> char c;
> foo(c);    //ok
> </code>
> 
> you can't always tell if there is a collision until the call is made

Those are not considered overloads. By "those" I mean that functions from different namespaces are never considered as overloads of one another, and always result in collisions, even if the functions signatures are overload-compatible, such as foo(int) and foo(char). *Proper* overloads are only when the functions are from the same namespace. (with mixins being an uncertain case, but that's another story)
1 2 3 4 5 6 7 8
Next ›   Last »