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

Annotation Values: Booleans #637

Closed
ChristianGruen opened this issue Jul 25, 2023 · 2 comments · Fixed by #682
Closed

Annotation Values: Booleans #637

ChristianGruen opened this issue Jul 25, 2023 · 2 comments · Fixed by #682
Labels
Enhancement A change or improvement to an existing feature XQuery An issue related to XQuery

Comments

@ChristianGruen
Copy link
Contributor

Functions annotations in XQuery have become a popular feature to attach vendor-specific information (for unit testing, locking, RESTXQ, etc.) to functions.

Annotation values are limited to literals, though. It would often be helpful to supply boolean values, but we don’t have literals for that in the language.

I suggest enhancing the existing grammar…

Annotation  ::=  "%" EQName ("(" Literal ("," Literal)* ")")?

…and allowing the strings false() and true() as values:

Annotation  ::=  "%" EQName ("(" AnnotationValue ("," AnnotationValue)* ")")?
AnnotationValue  :=  Literal | "false()" | "true()"

The suggestion is upward compatible if we should decide later on that we want to allow arbitrary expressions for annotation values.

@ChristianGruen ChristianGruen added XQuery An issue related to XQuery Enhancement A change or improvement to an existing feature labels Jul 25, 2023
@michaelhkay
Copy link
Contributor

There's a minor problem with this if the default function namespace isn't "fn". I propose tackling that simply by saying that within the Annotation, the default function namespace IS "fn", regardless what it might be outside.

@ChristianGruen
Copy link
Contributor Author

There's a minor problem with this if the default function namespace isn't "fn". I propose tackling that simply by saying that within the Annotation, the default function namespace IS "fn", regardless what it might be outside.

Good point. +1.

I wasn't sure if we should also allow fn:true() and fn:false(). I eventually omitted those in order to minimize hard-coded string handling.

@michaelhkay michaelhkay added the PR Pending A PR has been raised to resolve this issue label Sep 5, 2023
@ndw ndw closed this as completed in #682 Sep 12, 2023
@ChristianGruen ChristianGruen removed the PR Pending A PR has been raised to resolve this issue label Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A change or improvement to an existing feature XQuery An issue related to XQuery
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants