Operator overloading, structs
Leandro Lucarella
llucax at gmail.com
Wed Jun 10 08:08:14 PDT 2009
bearophile, el 10 de junio a las 08:23 me escribiste:
> Don:
> > It's very important. If you allow implicit conversion to bool, all kinds
> > of garbage will compile. You might as well abandon static typing.
>
> Some half-backed ideas.
> opBool() can be called implicitly when it's required a truth value test, like in if(x), while(x || y), etc.
> So this produces a type error:
> bool b = x;
I just can't understand why someone would not want this conversion to work
without a cast. Can anyone explain to me?
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
"All mail clients suck. This one just sucks less." -me, circa 1995
More information about the Digitalmars-d
mailing list