This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29427 - [FO31] map:get
Summary: [FO31] map:get
Status: CLOSED WORKSFORME
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-07 13:05 UTC by Benito van der Zander
Modified: 2016-03-21 23:28 UTC (History)
2 users (show)

See Also:


Attachments

Description Benito van der Zander 2016-02-07 13:05:31 UTC
1. There is something missing in this sentence: " In this situation the entry that is returned is ยทยท." 

2. It would be nice if there was a three parameter form map:get($map, $key, $default) that returns $default instead (), if $key does not exist. Otherwise, if you have a map that can contain () and you do not need () as default value, you have to do a contains/get call and that is twice as slow

3. It would be much easier to use if it could be used with a sequence $keys as xs:anyAtomicType*. As in $map(("a", "b", "c")) too, to return a sequence ($map("a"),$map("b"),$map("c"))

Especially after the arrow operator was modified/clarified. Previously you could have thought that you could write ("a", "b", "c") => $map to get all the keys, but after 27537   it is clear that this would become $map(("a", "b", "c")), so you can't and that is a pity.
Comment 1 Michael Kay 2016-02-07 13:50:47 UTC
1. The typo has already been fixed in the current WD.

2. Possibly, but you've had over four years to make this comment; it's too late to make such tweaks now.

3. We made a policy decision a long time ago that in the interests of consistency, functions should not implicitly map over their operands. The lookup operator ("?"), however, maps over both operands.

The arrow operator has never been a mapping operator, though some people wanted it to be. If it were, it would have very inconsistent behaviour depending on whether the first argument of the function accepts a sequence or not.
Comment 2 Benito van der Zander 2016-02-07 14:46:13 UTC
>2. Possibly, but you've had over four years to make this comment; it's too late to make such tweaks now.

Four years? How?
The public draft was only there for two years. 

And I had to read and implement 3.0 first, so I could only start reading 3.1 this year.  And I just learned what the W3C phases mean. It says CR can revert back to WD. Perhaps that happens when there are enough bugzilla reports? Gonna write them
Comment 3 Michael Kay 2016-02-07 15:37:30 UTC
The first public specification of maps appeared in the XSLT working draft dated July 2012. Since then there have been endless debates on the fine detail of the set of functions to be provided, and many suggestions which have been incorporated and others which have been rejected. Many products have shipped implementations because they can't wait for ever for the standard to be ratified. It doesn't serve the interests of the community to keep extending the debate whenever a new participant discovers the spec and wants to add their own particular features or variations.
Comment 4 Abel Braaksma 2016-02-07 19:56:00 UTC
> It doesn't serve the interests of the community to keep extending the debate 
> whenever a new participant discovers the spec and wants to add their own 
> particular features or variations.
You may find it of interest to have a look at EXPath (http://expath.org/), which serves as an extendable collection of changes, proposals, functions of which some (like the Binary module) were originally considered for the spec but for one reason or another didn't make it. Feel free to join. There's much more wiggle room inside EXPath than there will ever be in the W3C standardization process (the latter for good reason, I think, albeit sometimes unfortunate).
Comment 5 Benito van der Zander 2016-02-07 23:31:27 UTC
>You may find it of interest to have a look at EXPath (http://expath.org/), which serves as an extendable collection of changes, proposals, functions of which some (like the Binary module) 

I know that one.

Costello posted on an xml mailing list about it. Of course just after I made up my own binary conversion function

(But I do not like calling functions. (not even map:get. just thought 2.3. are really needed) Probably there needs to be a way to declare operator overloading. Like in Scala, everything except ascii goes. )
Comment 6 Benito van der Zander 2016-02-07 23:38:33 UTC
>The first public specification of maps appeared in the XSLT working draft dated July 2012. 

These drafts need more advertising.

If I had heard about that draft in 2012, I would not have implemented JSONiq in 2013. JSONiq was advertised as the only XQuery map variant.


> Since then there have been endless debates on the fine detail of the set of functions to be provided

Sometimes you move too slow and sometimes way too fast
Comment 7 Andrew Coleman 2016-03-02 15:52:19 UTC
The Joint Working Groups reviewed this bug at the teleconference on 2016-03-01 and noted your feedback. It was agreed that this bug should be closed with no action for reasons summarised in comment 1.