Comparing apples and oranges

Ary Borenszweig ary at esperanto.org.ar
Tue Sep 29 08:12:48 PDT 2009


Andrei Alexandrescu wrote:
> Consider:
> 
> class Apple {}
> class Orange {}
> 
> void main() {
>     writeln(new Apple == new Orange);
> }
> 
> This program always prints "false".  By and large, it is odd that one 
> would attempt comparison between unrelated classes. I was thinking, is 
> this ever legitimate, or we should just disallow it statically whenever 
> possible?

Has this brought problems to anyone ever?



More information about the Digitalmars-d mailing list