D JSON (WAT?!)
Pavel via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 24 08:37:10 PDT 2014
On Thursday, 24 July 2014 at 15:34:22 UTC, Ali Çehreli wrote:
> On 07/24/2014 08:29 AM, Pavel wrote:
>
>> writeln(parsed["fail"] == null);
>>
>> Now compiler complains:
>>
>> Error: incompatible types for ((parsed.opIndex("fail")) ==
>> (null)):
>> 'JSONValue' and 'typeof(null)'
>>
>>
>> WAT?!
>
> Comparing against null should be done with the 'is' operator,
> not the == operator:
>
> if (x is null)
>
> Ali
My compiler disagreed:
app.d(8): Error: incompatible types for ((parsed.opIndex("fail"))
is (null)): 'JSONValue' and 'typeof(null)'
More information about the Digitalmars-d-learn
mailing list