DMD 0.165 release
Walter Bright
newshound at digitalmars.com
Mon Aug 21 12:45:59 PDT 2006
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.
More information about the Digitalmars-d-announce
mailing list