D JSON (WAT?!)

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 24 08:59:31 PDT 2014


Pavel:

> writeln(cast(bool)("fail" in parsed));
>
> Produces "false"... but why on earth boolean expression would 
> output null?

In D if you perform an associative array "in", the return isn't a 
boolean but a pointer. It's zero if the item is not present. And 
it's a valid pointer to the value if the key is present.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list