On Wed, 09 May 2012 10:13:01 -0400, bearophile <[email protected]>
wrote:
Gor Gyolchanyan:
Because the opBinary [...]
Thank for your answer, but I don't carte of "why" the D compiler accepts
that. I only care about the D compiler statically refusing that.
This also works too:
int opBinary(string s: "booya!")(...)
or this too:
int opBinry(string s: "+")(...)
opBinary is a valid symbol, and as a valid symbol, it is a valid function,
no matter whether the compiler calls it in a special way.
I don't think it is a terrible thing, and I think statically disallowing
that would be a worse idea.
And to answer the OP, 'is' is special, it signals a bitwise compare, no
matter what the contents of the type being compared.
That being said, I understand why you want to do that. I don't see any
way around it.
-Steve