One more thing we have to be aware of: In XQuery, we have lots of
different function items. I wonder if we should support all of these?

  declare function local:f() { 123 };
  inspect:serialize(map {}),
  inspect:serialize(local:f#0),
  inspect:serialize(substring#2),
  inspect:serialize(function() {1})



On Wed, Nov 5, 2014 at 3:23 PM, Marco Lettere <[email protected]> wrote:
> Hello all,
> just out of curiosity, would it be too hard to have a serialization tool for
> functions that does more or less the inverse of inspect:functions i. e.
> given a function item returns the full function code?
> The use case is that I want to send out a client:execute request that is a
> XQuery script where functions can be attached at runtime selecting them out
> of a "toolbox" xqm module. And of course I don't want to manually parse the
> xqm to cut out the required function which could be done but is not very
> elegant.
>
> Example:
>
> declare function local:f($i as xs:integer) as xs:integer{ $i + 1 };
>
> inspect:serialize(local:f#1)
>
> would yield the string "declare function local:f($i as xs:integer) as
> xs:integer{ $i + 1 };"
>
> I've seen that even if it is not possible to serialize or cast to string a
> function item, if the function is assigned to a map, calling map:serialize
> yields something similar to the full function code. So I thought maybe the
> serialization mechanism is already in place and would just need a bit of
> generalization.
> Regards,
> Marco.

Reply via email to