DMD 0.165 release
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Tue Aug 22 06:10:32 PDT 2006
Walter Bright wrote:
> BCS wrote:
>> Walter Bright wrote:
>>> BCS wrote:
>>>> given
>>>>
>>>> void foo(char[]);
>>>> void foo(char[] delegate());
>>>>
>>>> how do I force the use of the first?
>>> You can't.
>> Ouch!
>>
>> That could be bad where the evaluation of the expression has side
>> effects or is time (when not how long) critical.
>>
>> volatile char* vcp;
>> log("data is now: "~(vcp[0..10].dup));
>>
>> Will the (char[]) form ever get called?
>
> It won't compile, as it'll give an ambiguity error.
>
>> Any expression can be converted into a anon-delegate, so anything that
>> would work for the first, also works for the second. How is one picked
>> over the other?
>> This seems to be an "oddity" in the overload rules.
>
> 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.
More information about the Digitalmars-d-announce
mailing list