Re: [netmod] json empty leaf encoding strangeness [Re: WG Last Call for draft-ietf-netmod-yang-json-04 (until 2015-06-29)]

Carsten Bormann <cabo@tzi.org> Sat, 18 December 2021 19:02 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DD8A83A10AB for <netmod@ietfa.amsl.com>; Sat, 18 Dec 2021 11:02:48 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iJTjN1Lwg36o for <netmod@ietfa.amsl.com>; Sat, 18 Dec 2021 11:02:44 -0800 (PST)
Received: from gabriel-smtp.zfn.uni-bremen.de (gabriel-smtp.zfn.uni-bremen.de [134.102.50.15]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4333A3A00F7 for <netmod@ietf.org>; Sat, 18 Dec 2021 11:02:43 -0800 (PST)
Received: from smtpclient.apple (p5089a436.dip0.t-ipconnect.de [80.137.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4JGZww5QQNzDCgg; Sat, 18 Dec 2021 20:02:40 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <875yrlhjr6.fsf@nic.cz>
Date: Sat, 18 Dec 2021 20:02:40 +0100
Cc: Christian Hopps <chopps@chopps.org>, Eliot Lear <lear@lear.ch>, "netmod@ietf.org" <netmod@ietf.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <80C39075-B512-4771-BD06-077423A361EC@tzi.org>
References: <D1A4CEB7.B22F7%kwatsen@juniper.net> <20150624145325.GB38016@elstar.local> <m2lhf27sko.fsf@birdie.labs.nic.cz> <1640D503-A676-4BC5-82E6-E08ED04F7106@chopps.org> <4d8189be-aeea-9ed9-b43f-80580acd2b9a@lear.ch> <1FE71A45-2B1A-4B46-96FF-A1D781F4C47D@tzi.org> <DE0EA6BB-A3FB-40C9-BBDB-8ED8200E7FEE@chopps.org> <875yrlhjr6.fsf@nic.cz>
To: Ladislav Lhotka <ladislav.lhotka@nic.cz>
X-Mailer: Apple Mail (2.3654.120.0.1.13)
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/pksXM7mcpMsoK-6ynn-PtYNpY4g>
Subject: Re: [netmod] json empty leaf encoding strangeness [Re: WG Last Call for draft-ietf-netmod-yang-json-04 (until 2015-06-29)]
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 18 Dec 2021 19:02:49 -0000

On 18. Dec 2021, at 19:04, Ladislav Lhotka <ladislav.lhotka@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.

>    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 json@ietf.org for that discussion.

> 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.

Grüße, Carsten

(*) falsy: converted to false when implicitly coerced to a Boolean (Ant.: truthy)