Re: [Jsonpath] Remarks on the array slice operator described in https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2
Glyn Normington <glyn.normington.work@gmail.com> Tue, 17 November 2020 15:20 UTC
Return-Path: <glyn.normington.work@gmail.com>
X-Original-To: jsonpath@ietfa.amsl.com
Delivered-To: jsonpath@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ED0093A13FC for <jsonpath@ietfa.amsl.com>; Tue, 17 Nov 2020 07:20:56 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.097
X-Spam-Level:
X-Spam-Status: No, score=-1.097 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, FREEMAIL_REPLY=1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no 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 ARRSzGruWaZ1 for <jsonpath@ietfa.amsl.com>; Tue, 17 Nov 2020 07:20:55 -0800 (PST)
Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 D7E9D3A13EE for <jsonpath@ietf.org>; Tue, 17 Nov 2020 07:20:54 -0800 (PST)
Received: by mail-wm1-x32d.google.com with SMTP id c9so3606247wml.5 for <jsonpath@ietf.org>; Tue, 17 Nov 2020 07:20:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=eU0M4JujFh08bq675CQaiS2poUWpvYnfXE4D4MfbtvY=; b=muZQRcWNnlnfHqaM+oiFy913AsTQNVFqGWgL4om04RRA2PTTmc022hn42z5gsM7qYj gqIfV54pGodwRFPHjtHffVBEUJe9fkKc7socSKu/VgUpVHQqk61Mm0eM6pxs+Ys0/aRd qDM9SmGy+lLZGF6L3plcM5KzuWIIvezlo9nrrs5NurvwN7PluY3lYy3Rfu8BT5etU//M m5F2165XWMPfu7KMl+VdOeaCU/XGEOuvL8OYI2g//SE+HA/xuhW2thjZ011V42HtLE2U XXUIkHK1Emd0u8RV/EnfQDMlJQY6nVGLxuYwdK7Ho1Jfj+vD0T2OpmM7hwo271ILdKuQ jEfw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=eU0M4JujFh08bq675CQaiS2poUWpvYnfXE4D4MfbtvY=; b=j1Ouhr0DIYIQUYhbVxfZDSMPrvoEBQapHpO4tE9nZq5MniH572QetyNmFQ2SZO3kqR zDjpn1CBZoYR8/VbWtMTkGd+TuoLV0jSVdYbUlZPnIg3abStkEXzUGWI53wtpothorKL 3okzP1bhmgsLpQRRPQBODrIyL/8xMvMfrv8SzBD46EcNYVnvn+ru7WGJSXBVztfoZAhz mp+eB+TDWInImvYvn4iZ472Xfxksxy3cTbfcI9QZ8O1Sd+gYWgZ5UbQ6Bzq6LO3+yEIR nZVkfCUs5aqG9rZpURoMV5k+EWn/URnwuW0lPOMbbc4+J7Z26atyO7T6vLido71u+W0S l+sw==
X-Gm-Message-State: AOAM5302NXc8R7ZplqclE2maTuIQTkoP9NWOEeyv5YsdKP75tR43rDMH fgZCLpOh9QgzvDZ2yYURKbA=
X-Google-Smtp-Source: ABdhPJxr0fUHRdGNqaDQbsSwYmHwTroZGDaco0W731sSbIIQF6E5hV4uq2rKCHq98jbdLf1Ypj76pw==
X-Received: by 2002:a1c:5446:: with SMTP id p6mr102510wmi.167.1605626453146; Tue, 17 Nov 2020 07:20:53 -0800 (PST)
Received: from normingtong-a01.lan (2.144.199.146.dyn.plus.net. [146.199.144.2]) by smtp.gmail.com with ESMTPSA id b17sm27856995wru.12.2020.11.17.07.20.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Nov 2020 07:20:52 -0800 (PST)
From: Glyn Normington <glyn.normington.work@gmail.com>
Message-Id: <448EAD4C-D46F-40C3-9DAE-B5BB8CA458AA@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_2B4F7B61-7CDC-4D24-B825-7769E19E58D6"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\))
Date: Tue, 17 Nov 2020 15:20:51 +0000
In-Reply-To: <526A1BBB-17DE-441B-BBD3-3B1F184C366B@tzi.org>
Cc: Daniel P <danielaparker@gmail.com>, jsonpath@ietf.org
To: Carsten Bormann <cabo@tzi.org>
References: <mailman.54.1605297609.13519.jsonpath@ietf.org> <CA+mwktJb1RV0syupRYjmKvsS9okcjA-q+ZLoL+sSumWaMZF_fA@mail.gmail.com> <526A1BBB-17DE-441B-BBD3-3B1F184C366B@tzi.org>
X-Mailer: Apple Mail (2.3608.120.23.2.4)
Archived-At: <https://mailarchive.ietf.org/arch/msg/jsonpath/a7JIlnCO57wrPEYUDcJq9fCgYcE>
Subject: Re: [Jsonpath] Remarks on the array slice operator described in https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2
X-BeenThere: jsonpath@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: A summary description of the list to be included in the table on this page <jsonpath.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jsonpath/>
List-Post: <mailto:jsonpath@ietf.org>
List-Help: <mailto:jsonpath-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Nov 2020 15:20:57 -0000
The improvements below are welcome. I’ve made one clarification below. On 14 Nov 2020, at 20:08, Carsten Bormann <cabo@tzi.org> wrote: > > On 2020-11-14, at 20:30, Daniel P <danielaparker@gmail.com <mailto:danielaparker@gmail.com>> wrote: >> >>> From: Glyn Normington <glyn.normington@gmail.com> >>>> On 12 Nov 2020, at 17:37, Daniel P <danielaparker@gmail.com> wrote: >> >>>> Note that a slice expression in Goessner is defined with reference to >>>> the (long since abandoned) ECMASCRIPT 4. The original link is lost, >>>> but there is some discussion here, >>>> https://web.archive.org/web/20070125020659/developer.mozilla.org/es4/proposals/slice_syntax.html. >>> >>> We plugged that gap in the Gössner article thus: >>> >>> https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2 >>> >>> which may be a safer starting point for the WG. >>> >> Thanks! The ABNF for an array slice in that reference >> >> integer = [%x2D] (%x30 / (%x31-39 *%x30-39)) >> >> array-slice = [ integer ] ws %x3A ws [ integer ] >> [ ws %x3A ws [ integer ] ] >> ; start:end or start:end:step > > Looks good. From an editorial point of view, I’d use a separate definition DIGIT and DIGIT1 for %x30-39 and %x31-39 for readability. I’d also use "-" and "0" for the non-range terminals %x2D and %x30. (It may occasionally be necessary to use hex outside ranges, i.e., for case-sensitive letters, unless we want to use the ABNF extensions for case-sensitive letters in RFC 7405 — e.g., for the escapes. Please see the end of https://tools.ietf.org/html/rfc4997#page-44 <https://tools.ietf.org/html/rfc4997#page-44> for how this can be kept readable.) > >> is consistent with JMESPath, Python, and my understanding of >> ECMASCRIPT 4. Perhaps the comment could be expanded to highlight that >> all integer parts are optional. > > That is clearly said in the ABNF, but it certainly doesn’t hurt to spell this out in English as well. > (Also, the third colon with the optional integer following is optional.) > > The most obvious misunderstanding trap that is set up in the above draft is HEXDIG; this needs a English language comment that the letters A-F are indeed case-insensitive (i.e., also a-f). > >> I think this sentence is awkward: >> >> "An array slice is a union element consisting of two or three integers >> (in base 10 and which may be omitted) separated by colons." > > I think what this is trying to say is that [0:3] is exactly equivalent to [0, 1, 2], which is a union operator, so the result of [0:3] should also be what can be called a “union element”. Detailed terminology to be fixed... I added “is a union element" to remind the reader that an array slice is just one kind of union element. That may not be necessary. I wasn’t thinking of any equivalence between an array slice and a union of array indices, although that’s an interesting observation, especially as we address the more general questions of duplication and ordering. > >> More specifically, the use of the term "union element" seems to me to >> be unnatural and unnecessary. Nothing would be lost by substituting >> "An array slice consists of ..." >> >> Moreover, Goessner uses the term "union" once in >> https://goessner.net/articles/JsonPath/ <https://goessner.net/articles/JsonPath/>, and appears to be referring >> to expressions of the form >> >> union = "[" ( expression *( "," expression ) ) "]" >> >> where minimally one comma is required (Goessner's shorthand notation is [,]). > > The ABNF in draft-goessner-dispatch-jsonpath-00.txt merges this case with the single value-expression case, so [3], [3, 4], and [3, 4, 5] are handled by the same production, making the result of [3] a (trivial) union as well. > > Grüße, Carsten > > -- > Jsonpath mailing list > Jsonpath@ietf.org <mailto:Jsonpath@ietf.org> > https://www.ietf.org/mailman/listinfo/jsonpath <https://www.ietf.org/mailman/listinfo/jsonpath>
- [Jsonpath] Remarks on the array slice operator de… Daniel P
- Re: [Jsonpath] Remarks on the array slice operato… Carsten Bormann
- Re: [Jsonpath] Remarks on the array slice operato… Glyn Normington
- Re: [Jsonpath] Remarks on the array slice operato… Glyn Normington
- Re: [Jsonpath] Remarks on the array slice operato… Daniel P
- Re: [Jsonpath] Remarks on the array slice operato… Marko Mikulicic
- Re: [Jsonpath] Remarks on the array slice operato… Glyn Normington
- Re: [Jsonpath] Remarks on the array slice operato… Glyn Normington
- Re: [Jsonpath] Remarks on the array slice operato… Glyn Normington
- Re: [Jsonpath] Remarks on the array slice operato… Daniel P
- Re: [Jsonpath] Remarks on the array slice operato… Carsten Bormann
- Re: [Jsonpath] Remarks on the array slice operato… Glyn Normington
- Re: [Jsonpath] Remarks on the array slice operato… Glyn Normington
- Re: [Jsonpath] Remarks on the array slice operato… Michael Kay
- Re: [Jsonpath] Remarks on the array slice operato… Glyn Normington
- Re: [Jsonpath] Remarks on the array slice operato… Carsten Bormann
- Re: [Jsonpath] Remarks on the array slice operato… Michael Kay
- Re: [Jsonpath] Remarks on the array slice operato… Daniel P
- Re: [Jsonpath] Remarks on the array slice operato… Carsten Bormann
- Re: [Jsonpath] Remarks on the array slice operato… Tim Bray
- Re: [Jsonpath] Remarks on the array slice operato… Glyn Normington
- Re: [Jsonpath] Remarks on the array slice operato… Carsten Bormann