enum overloading

Ellery Newcomer ellery-newcomer at utulsa.edu
Sun May 23 09:17:01 PDT 2010


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

>
>> (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"; }


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


More information about the Digitalmars-d-learn mailing list