toString ugliness

Ary Borenszweig ary at esperanto.org.ar
Sun Dec 7 10:17:14 PST 2008


Jarrett Billingsley escribió:
> 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.

Ah, I see. Well, I'd like to see such an example then. :-P



More information about the Digitalmars-d mailing list