[Bug 27098] New: possibility of functions to return multiple arguments which can be used in the argumentlist of a functioncall.

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27098

            Bug ID: 27098
           Summary: possibility of functions to return multiple arguments
                    which can be used in the argumentlist of a
                    functioncall.
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Functions and Operators 3.1
          Assignee: mike@saxonica.com
          Reporter: r.stapper@lijbrandt.nl
        QA Contact: public-qt-comments@w3.org

I regularly build functions which return more than one result and where these
results need more processing. For example if I want a counter which runs along
in a hof:until-construction, but there are plenty more situations. I end up
building some sort of result-constructor-function which enfolds both result in
a single construction and using this function to return my functionrsult as a
single argument in a functioncall. In the calle function a need then to defold
the argument in its origional values. This is pretty cumbersome.

I wouldn't mind if a function could return a type of argumentset with the
possibility of moore than one argument, which can be used in the argumentlist
of a functioncall to an other (or perhaps the same) function.

I now use the following construction:

(: resultconstructorfunction :)
let $result.constructor :=
function( $a, $b, $c, ....){ function( $f) { $f( $a, $b, $c, .....)}}

(: returning multiple values from a function:)
declare function my_function
      ( $p1, $p2, ....)
      { .....
        return $result.constructor( $x, $y, $z, ....)
      } ;

(: using this result in a functioncall :)
$result( calledFunction( $u, ?, ?, ?, ....)

(: what I would like is: :)
calledFunction( $u, my_function( $q1, $q2, ....), ....)

Although laborious it works fine but only in case of the results of one
function in the argumentlist of the functioncall. If I need the results of more
functions in the argumentlist this construction doesn't work and than it really
get laborious.

The example shows on the other hand that xquery already contains some sort of
solution for this transmission of arguments.

The possibility of returning a argumentset with more than one argument as
functionresult which can be used within the argumentlist of an functioncall
would, in my opinion, result in more elegant and propably also faster code.

Rob Stapper.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Saturday, 18 October 2014 14:53:06 UTC