enum overloading

strtr strtr at spam.com
Sun May 23 10:08:18 PDT 2010


== Quote from Ellery Newcomer (ellery-newcomer at utulsa.edu)'s article
> On 05/23/2010 07:35 AM, strtr wrote:
> > Did I miss it or should I add a bug report?
> http://www.digitalmars.com/d/2.0/hijack.html
That's not really the D1 spec.. a bug report it is :D

> >
> >> (it strikes me that this is a necessary product of a loose type system)
> > It is? :)
> yes.
> here's an example which acts differently if you don't have it:
> module a;
> import b;
> import std.math;
> import std.stdio;
> string toString(double){ return "you want to use this function";}
> void main(){ writeln(toString(cos(1.0)); }
> module b;
> string toString(real){ return "covert ninja you don't know about"; }
Yep, tricky one. I wouldn't be mad at the compiler to use the ninja one
as I do understand the reasoning (using D1 that is)

> I tried telling walter that enums don't and won't suffer from this problem.



More information about the Digitalmars-d-learn mailing list