[Cbor] Re: EDN redux

Rohan Mahy <rohan.mahy@gmail.com> Wed, 07 August 2024 13:41 UTC

Return-Path: <rohan.mahy@gmail.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0A6EEC1D4A9D for <cbor@ietfa.amsl.com>; Wed, 7 Aug 2024 06:41:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.107
X-Spam-Level:
X-Spam-Status: No, score=-2.107 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] 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 ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BDpI2HmnWU0O for <cbor@ietfa.amsl.com>; Wed, 7 Aug 2024 06:41:53 -0700 (PDT)
Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 31B9BC1CAF51 for <cbor@ietf.org>; Wed, 7 Aug 2024 06:41:49 -0700 (PDT)
Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52efd08e6d9so2786608e87.1 for <cbor@ietf.org>; Wed, 07 Aug 2024 06:41:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723038107; x=1723642907; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TryLk/C8YpoSiei2qMaEk1a3WuQZXSFdtdoVZvnWDrA=; b=BFlxanEeTuCQcY1NTOT2beVKEZofLXP196keJ7RTaVkrwZ+6esQwnimzlz/0XvfDrI bvX72P/1eY1rEQLtBx/vUY4I6CexeIcKNslhBVwlESHSE5ob8ze79ZTMwuYyKiYgSOEI zOc81d6TRjqtkHk9Hg4+sbJ/bGDuoI3dPX+1lY27quRycysISpJdieKmgxBCjFQ8VOog rjuphTn55z9wNBLyitPEPXLDjCpM5MtZHnTRSJ8hQcjjsKpn+AE2aFwP/RKYazyKpmf3 cIfs4T6+LbVmnBt07mOXm3yCNHdRbfQtXgK0xqK7IZeI6AIWnhgd9ShODF2wR60eiBbO WP0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723038107; x=1723642907; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TryLk/C8YpoSiei2qMaEk1a3WuQZXSFdtdoVZvnWDrA=; b=esZnEO4cjkcviuVzFYC0pYxJLwlCi5x1TPn0Z3R7nfCK1dDYrYUHLcM9PdZBFCngMV 5BCOkwCPBlajVbdaPnM9ReYFNLpNUgYQEdLMuvL2tB3dFnkQT6Q5KrFK0fGRyqcFJfnS BY4uAZi/hKfc+DHuhniXkLIpqMHofsIiT5gH9YyLAlveqn02aVKgEmUfL3AXFOrQx+fj lgvDT+3mdGlJFJ8aa7t+q3/o4Tur2JRZsp9lnPJjDra2w8YnRO6nUWubKh4bIQPkjwqZ MumfKk0wc3rm0N7hjniuKxbhZ+vMuLdBb/2QSet6cvrAOu5VDhQ+V/6OEEvegrhzY1VW Da/w==
X-Gm-Message-State: AOJu0YxhRNzg/myyTJsqUX2FYbyFqqACsxgZWtHW/40k9bx9WxntqkiS mY9N4l3ENOYPiuBg0Vcb2Y/yJ2YI71xUnqnMhChgG8ljDviKFoGEWWEqom/jOPsgjZ17ItbUhei iIuovMxmYfBDlkBfjS5ig4ZTEovU=
X-Google-Smtp-Source: AGHT+IGFRF6q3hehHa8merhg0dbJeUkhCETYVqHRHxRxq6sxMGKps+Oy+X6IrO8+O80fMzrEIJvTP13lp9/0HPkyChg=
X-Received: by 2002:ac2:558c:0:b0:530:c1fc:1c32 with SMTP id 2adb3069b0e04-530c1fc1e55mr8315903e87.45.1723038106316; Wed, 07 Aug 2024 06:41:46 -0700 (PDT)
MIME-Version: 1.0
References: <7C93E178-2D2A-44E1-96A2-EB55048052DD@tzi.org>
In-Reply-To: <7C93E178-2D2A-44E1-96A2-EB55048052DD@tzi.org>
From: Rohan Mahy <rohan.mahy@gmail.com>
Date: Wed, 07 Aug 2024 06:41:36 -0700
Message-ID: <CAKoiRuZebuHWhZ1AK6TPZDAdYgvQQBkM7Hdeyi7X=aFfFeQ3PQ@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Content-Type: multipart/alternative; boundary="00000000000042faf0061f18128c"
Message-ID-Hash: LDNVVUCUBZDCOOEKL4AG52I427SIWRFT
X-Message-ID-Hash: LDNVVUCUBZDCOOEKL4AG52I427SIWRFT
X-MailFrom: rohan.mahy@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cbor.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: CBOR <cbor@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [Cbor] Re: EDN redux
List-Id: "Concise Binary Object Representation (CBOR)" <cbor.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/U0aNXJ5ihYx4gOlIjzoJJ1hkLFE>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Owner: <mailto:cbor-owner@ietf.org>
List-Post: <mailto:cbor@ietf.org>
List-Subscribe: <mailto:cbor-join@ietf.org>
List-Unsubscribe: <mailto:cbor-leave@ietf.org>

The analogy with JSON is critically flawed because the JSON format is used
"on the wire" as is, while EDN app-strings need to be converted to a
specific format (often bstrs) in CBOR, each with their own grammar.

All other substantive applications of ABNF at IETF use a single pass
definition of the grammar. Using the ABNF in another way goes against 40+
years of precedent. It is just weird and will trip up other implementers.

The examples given where someone wanted to include an ABNF in an app-string
from an earlier specification which is broken or inconsistent, clearly
signal to me that spec writers need to take the time to fix those problems
by writing a clean ABNF rather than write new specs that import garbage
productions wrapped with extra layers of encoding and processing.

Overall this two-pass concept has been optimized to make life harder for
implementers and easier for people who want to specify new app-strings. We
should not be writing IETF specifications with that property.
thanks,
-rohan

On Wed, Aug 7, 2024, 03:51 Carsten Bormann <cabo@tzi.org> wrote:

> We didn't have enough time in Vancouver to complete the discussion
> about the EDN ABNF in draft-ietf-cbor-edn-literals.
>
> ## Explanation: Analog
>
> In Vancouver, Christian Amsüss had a good explanation in the form of
> an analog that I would like to try repeating here.
>
> For JSON, RFC 8259 provides an ABNF.
> This ABNF describes the grammar for valid JSON texts.
> These JSON texts are typically parsed by a JSON parser to yield a
> (parsed) JSON value.
> The JSON value is not described by RFC 8259 in any formal way, but
> intuition (= previous knowledge) about programming languages with
> built-in data representation formats (and specifically JavaScript)
> makes it relatively clear how the JSON value looks like and is
> obtained from the parsed JSON text.
>
> Some application may want to transport a URI in a JSON string.
> RFC 3986 provides an ABNF grammar for URIs.
> (This was done before JSON was written up, but the sequence here isn't
> relevant; it just shows the independence/loose coupling achieved.)
>
> To use URIs in a JSON text, the application parses/validates the JSON
> text (e.g., using the ABNF in RFC 8259), constructs the JSON value
> (which embeds a JSON string) based on the above intuition (ABNF
> doesn't help with that), and then parses/validates the JSON string
> (e.g., using the ABNF in RFC 3986).
>
> This procedure is so obvious I'm not aware of any document than even
> describes how the two ABNF grammars interact (they don't, directly,
> only via the intuition-based transformation of the parsed JSON text
> into a JSON value).
>
> ## Applying the analog to EDN
>
> We would like to do exactly the same with application-oriented
> literals in EDN: represented in sqstr (~ JSON text), parsed/validated
> (e.g., using the ABNF in Section 4.1 of EDN), transformed to the
> content of the sqstr (same intuition works here right away, as sqstr
> is mostly adapted from JSON strings), then parse/validate (e.g. using
> the ABNF in 4.2.x or a separate document) for the specific application
> oriented literal.
>
> What PR #49 proposes would be as follows in the JSON/URI example:
>
> * Define ABNF that merges the ABNF grammar for strings in JSON texts
>   (RFC 8259), the transformation of parsed input into a JSON value,
>   and the ABNF grammar for URIs (RFC 3986), into a single piece of
>   "single-pass" ABNF.
>
> * Modify the ABNF grammar for JSON to include this new ABNF.
>
> * Build a new JSON parser that includes this modified grammar; make
>   sure that such a modified JSON parser is available everywhere where
>   JSON is ingested with URIs to be included in JSON strings.
>
> This clearly *can* be done.
>
> It is not what we want to do; we are quite happy with the way JSON is
> processed today.
> (EDN is an extended form of JSON, by the way, so the analog is
> actually rather close here.)
>
> ## Side discussions
>
> The side discussion on whether ABNF is used correctly in the WG
> specification is somewhat sophistic.
> I can't follow this discussion, as it is not about anything that is
> material for the use of ABNF and its ecosystem for EDN.
>
> We cited RFC 8288 as an example that corrected the earlier approach of
> the spec it obsoleted (RFC 5988), which was conflating the base
> grammar of Web links with the grammars for each specific parameter in
> a similar way that PR #49 does.
>
> That approach created interoperability problems (as many of us noticed
> when implementing RFC 6690, which is based on the single-pass grammar
> attempt in RFC 5988).
>
> ### Side-side discussion
>
> RFC 8288 describes individual parameter grammars without typing in a
> name and an equals sign as in the ABNF production in ABNF's grammar:
>
>    rule           =  rulename defined-as elements c-nl
>
> ...essentially only keeping elements and c-nl; one can discuss whether
> that description technique is strictly following STD68.
> We are not doing this (all ABNF grammars in the WG spec parse
> correctly using the grammar for ABNF in RFC 5234), so this point is
> not relevant for this discussion.
>
> ## Conclusion
>
> I'm proposing that we now decide to keep the approach for describing
> EDN that maintains separation between the parsing and transformation
> of sqstr on one hand and the grammars for individual
> application-oriented literals on the other hand.
> This will allow us to use ABNF grammars such as those in RFC 3986 and
> RFC 3339 as well as those of future application-oriented literals
> already described in RFCs, unchanged.
>
> With that, I'm asking to stop blocking on the proposal made in PR #49
> and continue processing the document.
>
> Grüße, Carsten
>
>
> _______________________________________________
> CBOR mailing list -- cbor@ietf.org
> To unsubscribe send an email to cbor-leave@ietf.org
>