[FO] Built-in function changes to support default values #70
Labels
Enhancement
A change or improvement to an existing feature
XQFO
An issue related to Functions and Operators
This issue tracks the changes needed to the built-in functions to allow them to combine the declarations into a single definition with default parameter values.
The general approach to this is to make required arguments optional if they are for a function signature that is not the lowest argument count signature, and move any associated logic into the function.
array:subarray
array:subarray
/$length
fromxs:integer
toxs:integer?
.Rules
Except in error cases, the result of the function is the value of the expression op:A2S($array) => fn:subsequence($start, $length) => op:S2A().
Error Conditions
A dynamic error is raised [err:FOAY0001] if $start is less than one or greater than array:size($array) + 1.
A dynamic error is raised [err:FOAY0002] if $length is not an empty sequence and is less than zero.
A dynamic error is raised [err:FOAY0001] if $length is not an empty sequence and $start + $length is greater than array:size($array) + 1.
fn:concat
This should be modified to use a sequence-variadic signature, either as a 1 parameter function (taking an
xs:anyAtomicType*
value, allowing 0 and 1 arguments), or a 3 parameter function with the last parameter having the typexs:anyAtomicType*
.fn:differences
The
$options
parameter should be moved to the end of the parameter list in order to make the function a map-variadic function when default values are applied. This then makes it possible to specify the collation argument using a keyword argument in addition to specifying options as keyword arguments.fn:resolve-uri
fn:resolve-uri
/$base
fromnode()
tonode()?
.fn:subsequence
fn:subsequence
/$length
fromxs:double
toxs:double?
.When $length is the empty sequence, this function returns:
When $length is not the empty sequence, this function returns:
fn:substring
fn:subsequence
/$length
fromxs:double
toxs:double?
.More specifically, when $length is not the empty sequence the function returns the characters in $value whose position $p satisfies:
When $length is the empty sequence the function assumes that $length is infinite and thus returns the ·characters· in $value whose position $p satisfies:
fn:tokenize
fn:tokenize
/$pattern
fromxs:string
toxs:string?
.If $pattern is the empty sequence, the $value argument is set to
fn:normalize-space($value)
and $pattern is set to' '
.fn:unparsed-text / fn:unparsed-text-available
fn:unparsed-text
/$encoding
fromxs:string
toxs:string?
.fn:unparsed-text-available
/$encoding
fromxs:string
toxs:string?
.fn:unparsed-text-lines
fn:unparsed-text-lines
/$encoding
fromxs:string
toxs:string?
.The result of the function is the same as the result of the expression
fn:tokenize(fn:unparsed-text($href, $encoding), '\r\n|\r|\n')[not(position()=last() and .='')]
.Collations
fn:collation-key
/$collation
fromxs:string
toxs:string?
.fn:compare
/$collation
fromxs:string
toxs:string?
.fn:contains
/$collation
fromxs:string
toxs:string?
.fn:contains-token
/$collation
fromxs:string
toxs:string?
.fn:deep-equal
/$collation
fromxs:string
toxs:string?
.fn:differences
/$collation
fromxs:string
toxs:string?
.fn:distinct-values
/$collation
fromxs:string
toxs:string?
.fn:ends-with
/$collation
fromxs:string
toxs:string?
.fn:index-of
/$collation
fromxs:string
toxs:string?
.fn:max
/$collation
fromxs:string
toxs:string?
.fn:min
/$collation
fromxs:string
toxs:string?
.fn:starts-with
/$collation
fromxs:string
toxs:string?
.fn:substring-after
/$collation
fromxs:string
toxs:string?
.fn:substring-before
/$collation
fromxs:string
toxs:string?
.fn:uniform
/$collation
fromxs:string
toxs:string?
.fn:unique
/$collation
fromxs:string
toxs:string?
.Passing the empty sequence to the $collation argument is equivalent to supplying the default collation to that argument.
The text was updated successfully, but these errors were encountered: