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

Clarify that options and attributes are unordered #751

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ the following steps are taken:

#### Option Resolution

The result of resolving _option_ values is a mapping of string identifiers to values.
The result of resolving _option_ values is an unordered mapping of string identifiers to values.
Copy link
Member

Choose a reason for hiding this comment

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

This might be too strong. An implementation would not be incorrect to order the options internally--that would be an implementation detail. What's important is that functions cannot count on the ordering or make the ordering significant.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has that effect. It's still possible for an implementation to use a container that retains order to represent the options, but with this qualifier functions can't rely on that.

Copy link
Member

Choose a reason for hiding this comment

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

I'm trying to be parsimonious about what we change. The existing text doesn't say anything about order, thus you can't count on it (especially since we disallow ordering elsewhere). But I can live with this.


For each _option_:

Expand Down
7 changes: 7 additions & 0 deletions spec/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ and from each other by whitespace.
Each _option_'s _identifier_ MUST be unique within the _annotation_:
an _annotation_ with duplicate _option_ _identifiers_ is not valid.

The order of _options_ is not significant.

```abnf
option = identifier [s] "=" [s] (literal / variable)
```
Expand Down Expand Up @@ -764,6 +766,11 @@ The _value_ of an _attribute_ can be either a _literal_ or a _variable_.

Multiple _attributes_ are permitted in an _expression_ or _markup_.
Each _attribute_ is separated by whitespace.
Each _attribute_'s _identifier_ MUST be unique within the _expression_ or _markup_:
an _expression_ or _markup_ with duplicate _attribute_ _identifiers_ is not valid.

The order of _attributes_ is not significant.


```abnf
attribute = "@" identifier [[s] "=" [s] (literal / variable)]
Expand Down