Re: The map-lookup-forgiveness problem

On Tue, 2023-02-07 at 21:36 +0000, Michael Kay wrote:
> 
> The question we're addressing, if I understand it correctly, is what
> to do when E is a sequence, and when it contains some items for which
> e?X is defined (i.e. maps and arrays) and other items for which e?X
> is not defined and throws an error.

if the items in E are not maps, then it sounds like a mistkae in the
query to try and look things up in them, and i don't think i want that
silently ignored. If i need to i can write a function using typeswitch
or whatever.

Same with "boy"/noise/dirt

I get an error with
let $items := (<boy><noise>bang</noise></boy>, <boy/>,
<boy><dirt><noise>ew</noise></dirt></boy>, "child")
return $items//noise

However, if the items are all elements it's of course fine.

So if E were to be a sequence of maps, $E??noise should be fine as long
as every item in E is a map. ()??noise would return the empty sequence,
just as ()//noise does.


> What's the objection to writing `E[. instance of map(*)]?X ` - is it
> just that's it's wordy?

That, and that most people won't know to do it.

However, i am still nervous that ?? means something closely related but
different in JavaScript.

liam



-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

Received on Tuesday, 7 February 2023 22:29:46 UTC