[xquery-talk] xquery 3.1 wishlist

Christophe Geiser christophe.geiser at e-smile.org
Mon Jul 6 03:15:06 PDT 2015

On Mon, Jul 6, 2015 at 10:09 AM, Michael Kay <mike at saxonica.com> wrote:

Adding capability to XQuery 3.1 at this stage will require a more
> convincing justification than “I felt the need for this in some edge cases”.

On Mon, Jul 6, 2015 at 10:40 AM, Christian Grün
[christian.gruen at gmail.com](mailto:christian.gruen at gmail.com)
<http://mailto:[christian.gruen@gmail.com](mailto:christian.gruen at gmail.com)>

The function call might disappear in the evaluated code, and the
> resulting expression "123 + 456" might include no reference to the
> original function anymore.
Thanks Michael and Christian,

Understood and agreed. I was not aware that 3.1 was so close from final and
did not mean to be insistent. So far, I am not aware of other Functional
languages proposing this type of feature, so consider this request as
closed ; )


Just to elaborate on one example “edge case”, this the type of pattern I
use for some restxq resource functions (Adam’s Retter eXist
implementation). It has the advantages of attaching higher level success
and error messages as metaData to resource functions. Having a
function-item() function returning the current function being executed
would avoid re-typing the function item local:myResourceFunction#arity when
the signature of the function changes - not much more convincing as a
justification !

  %rest: ... restxq annotation for the function
  %msg:success('successKey', 'successMessage'),
  %msg:error('errorKey', 'errorMessage'),

  function local:myResourceFunction($args) {
      let $fn:= function() {
        let $initialCheck := loginAttemptAndOtherChecks($args) (:
throw an exception if not succesfull:)
        let $doTheWork:= local:doTheWork($args)
      return local:processResoureFunction($fn, local:myResourceFunction#arity)

declare function local:processResourceFunction($fn, $callee ) {
    try {

   } catch * {
      local:retrieveErrorMessage($callee, $err:code, $err:description,

declare function local:doTheWork() {
   (: do the work here, throw exceptions on errors:)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://x-query.com/pipermail/talk/attachments/20150706/e204ae1f/attachment.html>

More information about the talk mailing list