Carsten Bormann <c...@tzi.org> writes: > On 18. Dec 2021, at 19:04, Ladislav Lhotka <ladislav.lho...@nic.cz> wrote: >> >> 'foo: null'? Doesn't that make testing for empty values a major >> pain? 'if (foo)' would not work. > > Same with »false«, which 7951 is not escaping into an array. This > argument simply doesn’t hold water. As was mentioned, you would > check »”foo” in o«, which works for null, false, and all other > values that may happen to be falsy(*) in the platform.
The whole story is that Phil wanted to have both empty and boolean values as JSON strings. The result was a compromise, and I thought that [null] was a much better choice because, unlike "null" string, it cannot otherwise appear as a valid value of a YANG leaf. > >> JSON evolved from Javascript, so it must keep the javascript >> meanings for these keywords. > > That is a common misconception that must be stamped out, but we have > j...@ietf.org for that discussion. It's not that I am defending these views. I did argue with RFC 4627, but not too hard, as this seemed like a marginal issue at that time - much more fundamental objections against the JSON representation were raised back then. > >> It is indeed true that tests in JavaScript cannot really distinguish between >> a non-existent member and member with the value of 'null'. I remember I >> wasn't happy about this change but I thought it wasn't a big deal. > > As mentioned, they can. > And, yes, this little unnecessary complexity is not a big deal even if it is > based on mistaken beliefs; every non-trivial protocol has some unburied > zombies in the basement. Right, in hindsight it was a mistake. It is also worth noting that [null] is only an on-the-wire value, so e.g. None can be used internally in Python. I have written a lot of related running code and don't find it a serious problem. Lada > > Grüße, Carsten > > (*) falsy: converted to false when implicitly coerced to a Boolean (Ant.: > truthy) > -- Ladislav Lhotka Head, CZ.NIC Labs PGP Key ID: 0xB8F92B08A9F76C67 _______________________________________________ netmod mailing list netmod@ietf.org https://www.ietf.org/mailman/listinfo/netmod