Re: [Last-Call] [Jsonpath] Opsdir last call review of draft-ietf-jsonpath-base-16

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3. Aug 2023, at 22:33, Tim Bray <tbray@xxxxxxxxxxxxxx> wrote:
> 
> where’s the guidance on when/when-not to use them?”  It really does feel like something is missing. Is there nothing useful that we could say?

This is a bit like guidance on when to say 3 + 6 and when (3 + 6) — or maybe when to say 3 + 3 * 2 and when 3 + (3 * 2).

JSONPath doesn’t need the parentheses.

I can think of two reasons why you would put them:

(1) If you want to write a query that works with JSONPath-base as well as an existing implementation that does require the parentheses.

(2) If you believe the parentheses increase readability (in general for a specific query, or possibly just to people that are used to the parentheses).

The situation reminds me a bit of the return statement in C.

I have seen many people habitually write `return (x)`, as if return required the parentheses.
It doesn’t.
Some people want the return look like a function call (which it doesn’t, because of the space — so some even write return(x)!).
(This of course is exactly the inverse of what you want to happen — a return statement should stand out!)
When I learned C, using parentheses (without space) was the style that was generally used — I honestly don’t even know whether parentheses maybe even were required in 6th edition UNIX…

OK, this example doesn’t quite transfer, as there is no analogy (or potential confusion) with a function call in a filter expression.
But I wouldn’t try to give guidance here for the same reasons I wouldn’t try to give guidance for return in C.

Grüße, Carsten

-- 
last-call mailing list
last-call@xxxxxxxx
https://www.ietf.org/mailman/listinfo/last-call




[Index of Archives]     [IETF Annoucements]     [IETF]     [IP Storage]     [Yosemite News]     [Linux SCTP]     [Linux Newbies]     [Mhonarc]     [Fedora Users]

  Powered by Linux