DMD 0.165 release

Bruno Medeiros brunodomedeiros+spam at com.gmail
Thu Aug 24 12:10:06 PDT 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)



More information about the Digitalmars-d-announce mailing list