Open ChristianGruen opened 5 days ago
I was looking at those sections recently as well. I think it would be nice if we had explicit markup for the properties, so that I could easily and reliably build a table of all the functions and their properites, for example. But I became discouraged by the variety (the two argument form..., the three argument form...) and the comments about dependencies (calendar, time zone, etc.)
The text is generated from structured markup so the presentation could easily be changed.
An observation is that there is no function that is deterministic for some arities and nondeterministic for others, so we could perhaps factor that out.
We could also (at merge-function-specs line 128) look for cases where several different arities have the same property values, and factor that out: "With two or more arguments, the function is context-independent and focus-independent". Or rather than doing it in the stylesheet, we could extend fos:property/@arity
to allow values like "2-5" or "2+".
We could also combine the "focus-dependent" and "context-dependent" properties, replacing <fos:property>focus-dependent</fos:property>
with <fos:property dependency="focus">context-dependent</fos:property>
.
In many cases, if the user supplies an empty sequence as argument, the default value is used instead
This highlights that it is becoming misleading to speak of "the one-argument form of this function". It might be better to say (taking format-integer as an example): "If $language is absent or empty, the function is context-dependent (it depends on default language). In other cases the function is context-independent". This represents a change of the implied data model, so that the context-dependency of a function depends not so much on the arity, as on the presence or absence of specific parameters.
I try to understand the semantics behind the Properties section in the XQFO spec. Here are some examples of existing functions:
fn:format-integer
fn:format-time
fn:index-of
fn:element-number
I am afraid I cannot give hints for improvement yet; I just noticed it is increasingly difficult to interpret. For the moment, I wonder…
fn:index($a, $b)
andfn:index-of($a, $b, ())
should have identical properties, but the current wording implies that the three-argument of this function has different properties, e.g., it is said to rely in this case on the static base URI.fn:format-integer
), other have multiple descriptions (seefn:format-time
). Is there a particular rule behind that?