Skip to content

Change features to a sequence of 'any' #807

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

Merged
merged 3 commits into from
Aug 16, 2019
Merged

Change features to a sequence of 'any' #807

merged 3 commits into from
Aug 16, 2019

Conversation

toji
Copy link
Member

@toji toji commented Aug 14, 2019

/fixes #791

Updates the requiredFeatures/optionalFeatures dictionary keys to accept sequences of any values for forwards compatibility purposes. (Namely, enabling optionalFeatures to always ignore unknown values even if non-enum feature are introduced in the future.)

After the discussion in the above issue, I talked to @bfgeek about how to approach this particular concern. From that conversation it seemed that we either wanted to make this a array of object or an array of any, depending on which seemed to fit our use case better. I tested both in Chrome, and both value types worked. I chose any for the PR here because in Javascript strings are not considered to be "objects" (ie: "string" instanceof object == false). The WebIDL definition of object appears to be a distinct concept from the Javascript object type, but even reading through the WebIDL spec that's not readily apparent. As such using any felt like it was easier to understand on initial reading.

@toji toji added this to the August 2019 milestone Aug 14, 2019
index.bs Outdated
};
</pre>

The <dfn dict-member for="XRSessionInit">requiredFeatures</dfn> array contains any [=Required features=] for the experience. If any value in the list is not a recognized [=feature name=] the {{XRSession}} will not be created. If any feature listed in the {{XRSessionInit/requiredFeatures}} array is not supported by the [=XRSession/XR Device=] or, if necessary, has not received a clear signal of [=user intent=] the {{XRSession}} will not be created.

The <dfn dict-member for="XRSessionInit">optionalFeatures</dfn> array contains any [=Optional features=] for the experience. If any value in the list is not a recognized [=feature name=] it will be ignored. Features listed in the {{XRSessionInit/optionalFeatures}} array will be enabled if supported by the [=XRSession/XR Device=] and, if necessary, given a clear signal of [=user intent=], but will not block creation of the {{XRSession}} if absent.

The feature lists accept any string. However, in order to be a considered a valid <dfn>feature name</dfn>, the string must be a value from the following enums:
The feature lists accept any value. However, in order to be a considered a valid <dfn>feature name</dfn>, the value must be a string from the following enums:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have a named list of acceptable values so that other specs may extend this easily?

Copy link
Member Author

Choose a reason for hiding this comment

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

Latest iteration makes this a bit more explicit, but I'm reluctant to duplicate the actual values into a list here because it's harder to maintain, especially if future modules extend the enums in question.

Copy link
Member

@NellWaliczek NellWaliczek left a comment

Choose a reason for hiding this comment

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

BIKESHEDDING WARNING I know we're splitting hairs here, but "feature value" seems pretty confusing to me. I'm not sure I have a better suggestions, though. Perhaps "feature description"?

@toji
Copy link
Member Author

toji commented Aug 16, 2019

Agreed that "feature value" sounds weird. Changed to "feature descriptor".

Copy link
Member

@NellWaliczek NellWaliczek left a comment

Choose a reason for hiding this comment

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

Thanks!

@toji toji merged commit 179683e into master Aug 16, 2019
@toji toji deleted the xr-feature-any branch August 16, 2019 22:29
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

Successfully merging this pull request may close these issues.

XRSessionInit has generic types and is not future proof
3 participants