On Mon, Jul 6, 2015 at 10:09 AM, Michael Kay <[email protected]> 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 [[email protected]](mailto:[email protected]) <http://mailto:[[email protected]](mailto:[email protected])> wrote: 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 ; ) Best, Christophe P.S. 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 ! declare %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 { $fn(), local:retrieveSuccessMessage($callee) } catch * { local:retrieveErrorMessage($callee, $err:code, $err:description, $err:value) } }; declare function local:doTheWork() { (: do the work here, throw exceptions on errors:) };
_______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
