Skip to content
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

In which places is list ordering intended to be significant? #87

Open
jdougan opened this issue Jun 25, 2017 · 5 comments
Open

In which places is list ordering intended to be significant? #87

jdougan opened this issue Jun 25, 2017 · 5 comments

Comments

@jdougan
Copy link

jdougan commented Jun 25, 2017

eg. Is "class":["foo","bar"] supposed mean the same as "class":["bar","foo"] ?
Same thing for entities, links, actions, and fields.

@apsoto
Copy link

apsoto commented Jun 25, 2017 via email

@kevinswiber
Copy link
Owner

From Siren's perspective, there's no priority or significance to the array item position for strings in the class array.

Siren doesn't prescribe how clients should process classes; the spec only defines the semantic meaning. Your implementation gets to make the decision if it's significant.

@jdougan
Copy link
Author

jdougan commented Jun 26, 2017

I'm not sure how to read that. Either the semantics are such that "class":["foo","bar"] has the same meaning as as "class":["bar","foo"] (collection interpreted as a Set), the semantics say they are not the same (interpreted as an Array), or order must be preserved because it could be important (which is a restricted version of the second). There are no other choices, at least if you care about interoperability.

@kevinswiber
Copy link
Owner

From Siren's perspective, there's no priority or significance to the array item position for strings in the class array.

  1. There's no meaning associated with the contents of the class array.
  2. There are no processing instructions associated with how clients should interpret the elements of a class array.
  3. There is no composition guidance on how servers should combine multiple elements in the class array.

These are all deliberately outside the scope of the specification.

Prior work in this space includes the class attribute in HTML. Because HTML did not specify detailed semantics around class, CSS Selectors were able to use the attribute effectively.

If we look at SVG, the specification of the class attribute lists the following roles:

  • As a style sheet selector (when an author wishes to assign style information to a set of elements).
  • For general purpose processing by user agents.

The same is true for items in a Siren class array.

@jdougan
Copy link
Author

jdougan commented Jun 27, 2017

The W3C does put extra semantics beyond the encoding provided ones for their attributes in general and the class attribute is one of them. Specifically in HTML class, "duplicates are ignored", which appears to be a low-level processing instruction to me. This is the same kind of issue as ordering. Looking at that HTML spec text more closely regarding "set of space-separated tokens" referenced by the class attribute, they very carefully put ordered collection semantics around what is, in the XML model, a raw string. They also carefully defined unordered collection semantics for use elsewhere, as well as taking note that case-sensitivity will be defined elsewhere on a case-by-case basis.
As I (mis?)understand you, if the Siren class attribute was an hypothetically an XML attribute, you would be saying that the all of the interpretation of the raw attribute string would be delegated to the protocol consumers, since that is what the affordance of the encoding gives you.

The SVG spec you reference is unfortunately less clear. However a quick glance shows "set of class names" which may imply duplicates are removed and possibly, if less likely, that order is unimportant. With a quick search, the string "sequence of" is used 21 times in that SVG doc, so it is far from imposssible they are making the distinction, but not conclusive. Looking at the current SVG2 draft to see if it is any clearer, they are deprecating the SVG class attribute in favour of the one on the more general Element, and make specific reference to the WHATWG HTML spec's definition of "set of space-separated tokens".

I think you are misunderstanding the level of semantic clarification I'm trying to ask about. I am thinking about a low-ish level data model, suitable for mapping into and out of other encodings (without just pointlessly writing JSON in the other encoding) and for non-specialized tools for processing and generating Siren. I asked about class because it (incorrectly?) seemed like a simple place to start. I could have asked about class element duplication. I could have asked about ordering in the fields attribute. (For compatibiity with older HTML forms processing, it is probably useful to assume sequence matters there as it far too often does in real systems, under the terms of Postel's Law.) And, as I started this thread with, entities, links and actions are also where I am asking if the sequence is incidental to their representation, or core?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants