Re: [Json] Another problematic JSON Schema use-case

Phillip Hallam-Baker <ietf@hallambaker.com> Wed, 25 May 2016 18:19 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 69A5212D8B2 for <json@ietfa.amsl.com>; Wed, 25 May 2016 11:19:18 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.4
X-Spam-Level:
X-Spam-Status: No, score=-2.4 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.198, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 d45VtvVNe8dL for <json@ietfa.amsl.com>; Wed, 25 May 2016 11:19:17 -0700 (PDT)
Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D0C0312D8A9 for <json@ietf.org>; Wed, 25 May 2016 11:19:16 -0700 (PDT)
Received: by mail-io0-x243.google.com with SMTP id 190so6066889iow.2 for <json@ietf.org>; Wed, 25 May 2016 11:19:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=UD461lFzVgYSMoZvzYJe9RzHcVVhQ855ZIcNXCKAMe8=; b=DTD6JQCNrtHzg1IlEOUnEn3ItWXSTIdOIvfYVXB/GpDYhSgFIPr5sGr6rZGf8/2R+P 3tda6xbLP9tfNtIuFI0B7srZZFyaXLXXV14/B+SzbFGquTYTe8B0hDTUDbsN6kpVH43c hn3gJURZK+XnEQcQE1915fqUIOWYjj0Eu1vUWxHI5RNakqBUupyV3cgxA1cp8xiUPzIY jyqYkNDL3Lf347Dg244IrOEdBxivulsPpEDyef/RayZ9/RdNhsnE1uUkis1DApKhiiXr 5H2uwH/eQCFD6tuCawel3/zw/ItVLaO9rbcVxCQxmXZpEevgJObDRB9avP7DZXlJ85l0 CUCw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=UD461lFzVgYSMoZvzYJe9RzHcVVhQ855ZIcNXCKAMe8=; b=eiJI1XBLkpeedtataOGKIb3R1IIuxr1sCT4LZE3MQUUa9wkYlzFldbUfC5fUu+ll5W q5WGwINCdY3SIrss0eWrtDsKW1OEcQkOZIq+7E2ujRIuw1w6iLiDscZlbd+V1hoyI9su Pg+T9tJMMfm9x1KVYwJFwmpoiOdTXMrKHPC9lZXv615mTZnKkgv/UD1cQ5LxE5Uyth4q 8SFQlNMVtTciF/HD+6iuMLahaqDpm3x4qZr843Ad0zIp3lOJvfT243gXhmsA+w47L1g5 r4M+GwKqIK1WoLrs2jyb0AIH3Jwsd9J4o6A5Asn9MZX2OreWjSmWsYqYDuafjDl0f8VT EtjA==
X-Gm-Message-State: ALyK8tJaFPLSoRPIGouZ6CTeyZG3FA3bOMLaRreOBQPAuSKi2K1qpPgNHU/O3XBtjxyc9G8X540VuYtsDlMbeQ==
MIME-Version: 1.0
X-Received: by 10.200.54.170 with SMTP id a39mr4876894qtc.104.1464200353989; Wed, 25 May 2016 11:19:13 -0700 (PDT)
Sender: hallam@gmail.com
Received: by 10.55.25.105 with HTTP; Wed, 25 May 2016 11:19:13 -0700 (PDT)
In-Reply-To: <CAAQiQRdu2pixrXhuqqmWGjdab6_mCMVcPTKWQQu=Oh0n3MmW0g@mail.gmail.com>
References: <CAHBU6ivd5JJ7Hx_JtNPSnW40jXzEF1Yr7=rwuZzGnFrRoMphbg@mail.gmail.com> <CANkuk-WppF4WgeZc5OX2-tozmCd+eYtPwFgmDtoiJHxwdSjDzw@mail.gmail.com> <CAHBU6iu_nYyUBS-8PAJ3zER=RNKfiV532vEOeOnfr5eXbPv8Tw@mail.gmail.com> <CAAQiQRdu2pixrXhuqqmWGjdab6_mCMVcPTKWQQu=Oh0n3MmW0g@mail.gmail.com>
Date: Wed, 25 May 2016 14:19:13 -0400
X-Google-Sender-Auth: zhhUVPveMC6ZdW1DA9Sg7doINZI
Message-ID: <CAMm+Lwg2rWh0_gjXnSAEAvWtsMO1U3UiA8jsBzc+rRR6fiKcJg@mail.gmail.com>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
To: Andrew Newton <andy@hxr.us>
Content-Type: multipart/alternative; boundary="001a1141a612facca50533aeb5ec"
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/2d0Ef6Zb-tlDaVpYfTgRGrUT1ac>
Cc: Austin William Wright <aaa@bzfx.net>, Tim Bray <tbray@textuality.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Another problematic JSON Schema use-case
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 25 May 2016 18:19:18 -0000

The core problem with 'JSON Schema' is that either you like strongly typed
languages or you don't.

I have some very strong opinions on the advantages of strong typing. My
college tutor was Tony Hoare. But a lot of people don't see the point just
as a lot of folk in the nuclear physics lab used to turn off compiler
warnings to 'get rid of' their errors.

If you don't like strong typing then you probably won't see the value of a
schema language because you will be using languages that allow you to write
something like this

var DOM = JSON.Parse (Textfile);

Where JSON.Parse is a completely generic function that dumps out a tree
that you can then access through dynamic binding.

Dynamic binding certainly has advantages but it has what people from my
camp consider to be the serious disadvantage that you can't do static type
checking at compile time.

It also has the disadvantage that you end up with code that looks like this:

struct Furniture {
    string: Name;
    string: Type;
    }

Which serializes as

"Furniture" : { "Name" : "Aeron", "Type" : "Chair" }

Which is fine, if you don't want to use an object oriented language where
you would write something like:

class Furniture {
    string: Name;
    }

class Chair : Furniture {
    }

Which would typically serialize as :

"Chair" : {Name: "Aeron"}


If you design a protocol with strong typing in mind it is highly unlikely
that you are going to have problems using dynamic binding as a result. But
the reverse is not the case.

Since I do security, I insist on static type checking. Perl is fine for
writing a Web site mashup. It isn't something I would want to see used on a
CA.