toString ugliness
Jarrett Billingsley
jarrett.billingsley at gmail.com
Sun Dec 7 07:27:40 PST 2008
On Sun, Dec 7, 2008 at 7:12 AM, Ary Borenszweig <ary at esperanto.org.ar> wrote:
>> definition of toString that does match. Most of the time ADL leads to
>> confusing behavior, which is why it was dropped in D.
>
> But the overloading is obvious! It looks for toString(...) and it founds it
> in the class, but the overloading is wrong. So for me, it should keep
> looking in the enclosing scopes.
That's why I said "*most* of the time" ;) I'll agree that it's a bit
counterintuitive, but I'd rather have the compiler be a little stupid
in this regard than to pay the price of unexpected function matches
for a little bit of convenience.
More information about the Digitalmars-d
mailing list