Hi Hans-Juergen,
Thank you for the explanation and link. I wasn’t aware of that. So an item should always first be checked for map-type before checking it for function-type.
Learning new thing in the weekend.
Thanx,
Rob
PS. Same there for arrays too, as I read now.
Van: Hans-Juergen Rennau [mailto:hrennau@yahoo.de]
Verzonden: zaterdag 25 juli 2015 15:42
Aan: Rob Stapper; BaseX
Onderwerp: Re: [basex-talk] hickup in typeswitch
Hi Rob, no - this is no bug, as a map *is* a (special kind) of function.
Compare http://www.w3.org/TR/xquery-31/#id-maps ;
[Definition: A map is a function that associates a set of keys with values, resulting in a collection of key / value pairs.]
In other words, the expression
map{'p':'test'} instance of function(*)
MUST yield true, as it does in BaseX, as it does with Saxon.
Kind regards,
Hans-Jürgen
Rob Stapper <r.stapper@lijbrandt.nl> schrieb am 14:51 Samstag, 25.Juli 2015:
Hi,
I encountered a little but nasty to find hick-up in the typeswitch command.
One would expect the code below to return: “map”.
It returns: “function”.
Looks like a bug to me.
typeswitch( map { 'p' : 'test'})
case function(*) return 'function'
case map(*) return 'map'
default return 'other'
Rob Stapper
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. |
![]() |
Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
|