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

Extend enumeration types to allow values other than strings #743

Closed
michaelhkay opened this issue Oct 10, 2023 · 4 comments
Closed

Extend enumeration types to allow values other than strings #743

michaelhkay opened this issue Oct 10, 2023 · 4 comments
Labels
Abandoned PR was rejected, withdrawn, or superseded

Comments

@michaelhkay
Copy link
Contributor

In reviewing and accepting the spec for enumeration types, it was suggested that it might be useful to allow values other than strings.

  • There's a difficulty in that not all atomic values can be represented by literals. We have the same problem with function annotations; perhaps we need to bite the bullet and define some kind of "constant atomic expression" construct.
  • Aside from that, there don't seem to be any major obstacles.

We change

An EnumerationType has a value space consisting of a set of xs:string values. When matching strings against an enumeration type, strings are always compared using the Unicode codepoint collation.

to

An EnumerationType has a value space consisting of a set of atomic values. When matching values against an enumeration type, values are always compared using the fn:atomic-compare() function (as used for comparing map keys).

The subtyping rules (newly defined in terms of unions of singleton enumeration sets) seem to work in their current form, without change. enum("red", "green") is still a subtype of xs:string, because all the enumerated values are instances of xs:string.

@ChristianGruen ChristianGruen added XPath An issue related to XPath Enhancement A change or improvement to an existing feature labels Oct 12, 2023
@michaelhkay
Copy link
Contributor Author

Hmmm. If enumeration values are compared using fn:atomic-compare(), then 1.0e0 is an instance of enum(0, 1, 2), which means that enum(0, 1, 2) cannot be a subtype of xs:integer.

@ChristianGruen
Copy link
Contributor

Related: #283

@michaelhkay michaelhkay added the Propose Closing with No Action The WG should consider closing this issue with no action label Nov 8, 2023
@michaelhkay
Copy link
Contributor Author

michaelhkay commented Nov 8, 2023

I think the complications, especially those involving cross-type equality comparisons, mean that the costs of this feature don't justify the benefits, so I propose we close with no action.

@ndw
Copy link
Contributor

ndw commented Nov 14, 2023

The group agreed to close this issue without action at meeting 054

@ndw ndw closed this as completed Nov 14, 2023
@michaelhkay michaelhkay added Abandoned PR was rejected, withdrawn, or superseded and removed XPath An issue related to XPath Enhancement A change or improvement to an existing feature Propose Closing with No Action The WG should consider closing this issue with no action labels Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abandoned PR was rejected, withdrawn, or superseded
Projects
None yet
Development

No branches or pull requests

3 participants