==, is
Steven Schveighoffer
schveiguy at yahoo.com
Mon Nov 15 11:47:11 PST 2010
On Mon, 15 Nov 2010 14:36:33 -0500, Ellery Newcomer
<ellery-newcomer at utulsa.edu> wrote:
> parser definitely does it for !in, but it doesn't for the other ones,
> and I didn't want to go digging all over the place for it.
>
> Also, spec says yes for !in, but is silent for the other ones
http://www.digitalmars.com/d/2.0/operatoroverloading.html#equals
As far as is, it doesn't explicitly say that rewriting is done, but, it
does spell out that to do the opposite, use !is. Maybe the spec should be
updated to explicitly say x !is y is the same as !(x is y).
http://www.digitalmars.com/d/2.0/expression.html#IdentityExpression
>
> On 11/15/2010 01:08 PM, Steven Schveighoffer wrote:
>> On Mon, 15 Nov 2010 14:06:34 -0500, Ellery Newcomer
>> <ellery-newcomer at utulsa.edu> wrote:
>>
>>> quick question: are the following rewrites always valid:
>>>
>>> e1 != e2 -> !(e1 == e2)
>>> e1 !is e2 -> !(e1 is e2)
>>> e1 !in e2 -> !(e1 in e2)
>>
>> I believe this is in fact what the compiler does (rewriting).
>>
>> -Steve
More information about the Digitalmars-d-learn
mailing list