-
Notifications
You must be signed in to change notification settings - Fork 15
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
Annotations: Editorial notes #713
Comments
As Michael Kay noted, annotations are part of the function signature in the Data Model spec, even if languages like XPath don't define them:
|
it would be nice if expressions could be moved between XQuery and XPath wherever possible. I'd like to see annotations available in XPath. Ackermann's Function runs much faster if you cache the results, albeit using large amounts of memory :) |
Only as a temporary step, before either it is moved to the XQuery Specification, or annotations are added to XPath. In case we have no annotations capability in XPath, this function remains XQuery-specific and its place is exactly in the XQuery specification. |
Again, this pre-supposes that the XPath user knows XQuery and its annotations mechanism, which in general is not the case. Typically a user may need to access a function that is defined in XQuery, without needing its annotations, and not being aware at all that "annotations" exist, or whatever "annotations" may represent/stand-for. As a user advocate I stand firmly against polluting the specifications - having clear boundaries minimizes the confusion of the readers. |
This must be part of the description of the function, in order to avoid the otherwise inevitable confusion in most of any reader who is not using XQuery. @ChristianGruen, please confirm that the above text will be added. |
@liamquin Before doing that we need a quick tutorial on what annotations are, and what they are designed to achieve. Also about their scope and life-cycle. As for caching, any "caching-annotation" is equivalent to a caching-decorator and with the introduction of decorators in XPath such annotation will not be needed. |
Unfortunately we already have the function load-query-module(), so an XPath user must either have some understanding of XQuery or ignore the existence of this function. Exactly the same applies to the In fact it might well be that a primary use case for using function-annotations in XPath is where the XPath users wants to take advantage of an XQuery function library in this way: the annotations might be used to decide which functions to import. We're spending an awful lot of time deciding where to draw the boundaries between XPath and XQuery, and the reason it takes a long time to decide is that we have no consensus on the criteria we should apply when making the decision. |
If I am a user that doesn't know anything about XQuery and only knows that the function, when called with specific arguments produces specific, wanted result, I would definitely use The same definitely applies on any other function that is not written by the caller. Thus, any such user is not interested in the implementation details, including this function's "annotations" - whatever this might mean. |
They might well be interested in details such as "%requires-schema-aware-processor(true())". Generally I belong to the "keep XPath as small as possible" camp. But there are benefits in the fact that XPath and XQuery have exactly the same function library, and I don't want to lose that. |
I am not against adding "annotations" to XPath, just waiting to see what might be proposed and to be able to evaluate it. Till then, returning "annotations" from a function would be premature - like putting the cart before the horse. Also, it seems that (at least what I am trying to understand about "annotations") these behave similarly to some types of decorators but might be "more static" and thus not always flexible and usable. This is why I asked about the scope and life-cycle of "annotations". |
Annotations are kind of attributes of the type object. Let us have the type object as a first-class citizen of the language, then annotations can be part of the attributes/properties of any type, or of an instance of a particular type. |
I can help you create a little editorial pull request, you can then decide which phrases you want be added and where they should be placed in the text. |
The WG agreed to close this with no action on 2024-04-09. |
Copied from #710 (review):
…and my complementary note in the PR thread:
Additional notes from today’s meeting:
true()
as a default value.fn:function-annotations
to demonstrate how to check for annotations without values (or with values whose EBV isfalse()
:0
,""
, etc.).Feel free everyone to add more comments.
The text was updated successfully, but these errors were encountered: