Function annotations

I've had input from a user who wants to get information about the annotations on a function. 

Annotations don't seem to be part of the data model for function and we don't have any accessor functions that reveal the values of annotations.

My first thought is that it's easy enough to meet this requirement with an extension function, and the obvious one would be something like

function-annotations($f as function()) as map{xs:QName, item()*}

But the same user points out that Saxon isn't allowing several annotations on a function with the same name, although the spec appears to permit this. If the data model allows several annotations with the same name then this complicates the API.

So, a question: is it by design or by accident that we don't have any rule prohibiting multiple annotations on a function with the same name?

If we do allow it, is the order significant? Would you expect the order in which annotations appear to be retained in such an API?

Michael Kay

Received on Wednesday, 12 October 2016 10:02:36 UTC