-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Define Data Collections used in the spec #1102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for graphql-spec-draft ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one logical consistent way to describe these data structures is with a minimal amount of predefined terms would be:
-
Everything is a collection. A collection is a finite group of elements that can be iterated over. The encounter order during iteration is not necessarily stable.
-
A List is a specific collection where each element can be accessed via a stable Integer >= 0, called index and the encounter order is stable. A List allows for duplicate elements.
-
A set is a specific collection where the elements are guaranteed to be unique. The encounter is not necessary stable ("unordered set"), but can be ("ordered set")
(If we need to define unordered set vs ordered) -
A Map is a specific collection of elements, where each element is a pair (called "entry") made of a key and a value. All keys are a set, while all values is just a collection.
The encounter order of a Map can be stable ("ordered Map") or not ("unordered Map")
(If we need to define unordered Map vs ordered)
Hopefully my latest edit factors in @andimarek and @martinbonnin's feedback. |
|
||
## Data Collections | ||
|
||
A data collection is a finite, iterable aggregation of elements whose iteration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 'aggregation'?
- collection: tautology - "a data collection is a collection"
- set: we define "set" below, so using set here would introduce ambiguity
- group: evokes group theory, best avoided
- assembly: technically correct, but feels unnatural
(Replacement of #1091; to do PR stack with #1092 and #1063)
The spec uses the terms "set", "list" and "map" in many places. This PR defines these terms and their conformance requirements.
This is a change extracted from #1063 as discussed at last night's WG meeting
The next PR in this stack is:
cc @graphql/tsc