Skip to content
This repository has been archived by the owner on Oct 18, 2021. It is now read-only.

Rough draft #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Rough draft #1

wants to merge 2 commits into from

Conversation

glyn
Copy link
Contributor

@glyn glyn commented Nov 23, 2020

Note to reviewers: this is a very rough draft. Comments are welcome, but many terms need to be defined etc.

@glyn glyn requested review from mkmik and Zteve and removed request for mkmik November 23, 2020 16:43
@glyn glyn self-assigned this Nov 23, 2020
@glyn glyn requested a review from mkmik November 23, 2020 16:45
Copy link
Collaborator

@Zteve Zteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early days yet, and my understanding of context is poor.

README.md Show resolved Hide resolved
Comment on lines +22 to +23
<> s = <>
(x^y)s = (x s)^(y s)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much better, but we are no nearer understanding selectors from this. Can we assert that a selected sequence is a subsequence (not necessarily contiguous) of the original?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but each value in the selected sequence is a descendant (or equal to) of a value in the original sequence.

Comment on lines +28 to +29
If `m` and `n` are JSON objects with no keys in common, then `m ∪ n` is the JSON object containing
all the mappings of `m` and `n` (but no others).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything to say about common keys? The overuse of the term 'mapping' is potentially confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to define a partial operation as that's all we need in the remainder of the spec (I think). If we had to handle common keys, we'd need something like Z's function override. How about the following?

Suggested change
If `m` and `n` are JSON objects with no keys in common, then `m ∪ n` is the JSON object containing
all the mappings of `m` and `n` (but no others).
If `m` and `n` are JSON objects with no keys in common, then `m ∪ n` is the JSON object containing
all the pairs of keys and values from `m` and `n` (but no others).

README.md Show resolved Hide resolved
Comment on lines +39 to +42
`$` is effectively a no-op. If `t` is a JSONPath (without a leading `$`), then:
```
<v>$t = <v>t
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of thing is $? Is it a selector, a JsonPath or something else? What does it mean for a JSONPath to have a "leading $", and why does it matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are at least two schools of thought. I have tended to think of $ as a special selector which takes the input value and produces a sequence consisting of just that value. Others think of $ as a kind of delimiter which says "start at the root of the input value". The latter is more consistent with the use of $ in filter notation (which we'll come to later).

The original JSONPath article required all JSONPaths to start with $, but some implementations make this optional, just to confuse matters.

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
... details! ...
```

If `a` is not an array and `sl` is a slice expression, then:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a here is a value, I take it. Or an object. Hmm, I'm getting really confused here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a is probably the worst name for this case. It's any value which isn't an array. It could be an object or a scalar.

README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants