[Bug 27059] New: [xp3.1] Function coercion, maps and arrays

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 27059] New: [xp3.1] Function coercion, maps and arrays

Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27059

            Bug ID: 27059
           Summary: [xp3.1] Function coercion, maps and arrays
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XPath 3.1
          Assignee: [hidden email]
          Reporter: [hidden email]
        QA Contact: [hidden email]

Although the spec is probably technically correct, it would be worth some
explanation of how function coercion interacts with maps and arrays.

Firstly, if the expected type is a map or array type, then function coercion
does not apply. That's because the expected type is not [written as a]
TypedFunctionTest (bullet 3 of 3.1.5.2). Note that the bullets here are rather
varied in style, for example:

"If the expected type calls for a single item or optional single item"
"If the expected type is xs:string or xs:string?"
"If the expected type is a sequence of a generalized atomic type"

It would be better if they were all phrased in terms of how the type is
expressed syntactically.

Secondly, if the expected type is (expressed as) a TypedFunctionTest, and the
actual supplied value is a map or array, then function coercion does apply. For
example, fn:sort expects a function item of type function(item()) as
xs:anyAtomicType*, and it is acceptable to supply a map as the value of this
argument. If a map $M is passed, the rules of function coercion say that this
is equivalent to passing the function

function($key as item()) as xs:anyAtomicType* {
  $M($key)
}

which in general (unless there is an atomization failure) will work; the sort
key for any value not present in the map is an empty sequence.

It's certainly worth a note or an example to explain this.

Thirdly, if the expected type is written as function(*), then it is legal to
supply a map or array as the value of the argument, but no coercion takes
place.

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

Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 27059] [xp3.1] Function coercion, maps and arrays

Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27059

--- Comment #1 from Jonathan Robie <[hidden email]> ---
I need to rewrite this as a result of 21893. I will see what can be made
clearer when I do that rewrite.

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

Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 27059] [xp3.1] Function coercion, maps and arrays

Bugzilla from bugzilla@jessica.w3.org
In reply to this post by Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27059

Jonathan Robie <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Severity|normal                      |minor

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

Loading...