digitalmars.D - Re: yank unary '+'?
- bearophile <bearophileHUGS lycos.com> Dec 07 2009
- Don <nospam nospam.com> Dec 07 2009
Thanks to Andrei to explain the situation better. Denis Koroskin:OpTrue also implies opFalse, which is redundant.
C# allows to define both methods, but I don't like that. The compiler can just return the negation of opTrue, no need of opFalse. Is this a good enough solution? It looks better than using !!. Bye, bearophile
Dec 07 2009
bearophile wrote:Thanks to Andrei to explain the situation better. Denis Koroskin:OpTrue also implies opFalse, which is redundant.
C# allows to define both methods, but I don't like that. The compiler can just return the negation of opTrue, no need of opFalse. Is this a good enough solution? It looks better than using !!.
Only the compiler uses !! opUnary("!") is opFalse. BTW, the last line of operatoroverloading.html is: "The operators ! && || ?: and a few others will likely never be overloadable." Never say never.
Dec 07 2009