map:merge new semantics for 8.6
Monday, 31 October 2016 · 4 messages
MG
Marc van Grootel31 Oct 2016 13:43 #
Hi,
Any reason why the deault semantics for
map:merge in 8.6 changed in a backwards incompatible manner? Is this because of some XQuery/XPath spec thing? A while ago I switched to 8.6-SNAPSHOT just to be on the latest and greatest and I starting seeing weird things in my code. Initially I didn't bother to look at the docs as I didn't expect map:merge to have changed. At some point I even thought map:merge was broken in this snapshot. I often use map:merge for handling function options and I add the defaults first and then user options. With 8.6 this default behaviour has changed and I would have to switch this around or explicitly ask for 'use-last'. I can do but only by adding map { 'duplicates': 'use-last' }. This means I will have code <= 8.5 and I need to have different code for > 8.5.
Was this intentional? If not then I would vote for re-instating default behaviour (use-last).
Cheers,
--MarcCG
Christian Grün31 Oct 2016 13:50 #
Hi Marc,
The reason is why this was decided by the W3C; see [1] and related comments.
Sorry for that,
Christian
[1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=29723
Quoted text · Marc van Grootel · 21 lines
On Mon, Oct 31, 2016 at 1:43 PM, Marc van Grootel <marc.van.grootel at gmail.com> wrote: > Hi, > > Any reason why the deault semantics for map:merge in 8.6 changed in a > backwards incompatible manner? Is this because of some XQuery/XPath > spec thing? A while ago I switched to 8.6-SNAPSHOT just to be on the > latest and greatest and I starting seeing weird things in my code. > Initially I didn't bother to look at the docs as I didn't expect > map:merge to have changed. At some point I even thought map:merge was > broken in this snapshot. I often use map:merge for handling function > options and I add the defaults first and then user options. With 8.6 > this default behaviour has changed and I would have to switch this > around or explicitly ask for 'use-last'. I can do but only by adding > map { 'duplicates': 'use-last' }. This means I will have code <= 8.5 > and I need to have different code for > 8.5. > Was this intentional? If not then I would vote for re-instating > default behaviour (use-last). > > Cheers, > --Marc
MG
Marc van Grootel31 Oct 2016 14:13 #
Thanks Christian,
I feared as much ;-(
I understand the reasoning (processing efficiency and compatibility with parse-json) but find it unfortunate that backwards compatibility wasn't part of the reasoning as maps and
map:merge are not exactly new.
--MarcQuoted text · Christian Grün · 34 lines
On Mon, Oct 31, 2016 at 1:50 PM, Christian Grün <christian.gruen at gmail.com> wrote: > Hi Marc, > > The reason is why this was decided by the W3C; see [1] and related comments. > > Sorry for that, > Christian > > [1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=29723 > > > > On Mon, Oct 31, 2016 at 1:43 PM, Marc van Grootel > <marc.van.grootel at gmail.com> wrote: >> Hi, >> >> Any reason why the deault semantics for map:merge in 8.6 changed in a >> backwards incompatible manner? Is this because of some XQuery/XPath >> spec thing? A while ago I switched to 8.6-SNAPSHOT just to be on the >> latest and greatest and I starting seeing weird things in my code. >> Initially I didn't bother to look at the docs as I didn't expect >> map:merge to have changed. At some point I even thought map:merge was >> broken in this snapshot. I often use map:merge for handling function >> options and I add the defaults first and then user options. With 8.6 >> this default behaviour has changed and I would have to switch this >> around or explicitly ask for 'use-last'. I can do but only by adding >> map { 'duplicates': 'use-last' }. This means I will have code <= 8.5 >> and I need to have different code for > 8.5. >> Was this intentional? If not then I would vote for re-instating >> default behaviour (use-last). >> >> Cheers, >> --Marc
--
--Marc
CG
Christian Grün31 Oct 2016 14:15 #
Indeed. The W3C states that new features should be used with care as long as the spec. is not finalized. Of course it’s compelling enough (at least for us) not to wait until the very end…
Quoted text · Marc van Grootel · 50 lines
On Mon, Oct 31, 2016 at 2:13 PM, Marc van Grootel <marc.van.grootel at gmail.com> wrote: > Thanks Christian, > I feared as much ;-( > I understand the reasoning (processing efficiency and compatibility > with parse-json) but find it unfortunate that backwards compatibility > wasn't part of the reasoning as maps and map:merge are not exactly > new. > > --Marc > > On Mon, Oct 31, 2016 at 1:50 PM, Christian Grün > <christian.gruen at gmail.com> wrote: >> Hi Marc, >> >> The reason is why this was decided by the W3C; see [1] and related comments. >> >> Sorry for that, >> Christian >> >> [1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=29723 >> >> >> >> On Mon, Oct 31, 2016 at 1:43 PM, Marc van Grootel >> <marc.van.grootel at gmail.com> wrote: >>> Hi, >>> >>> Any reason why the deault semantics for map:merge in 8.6 changed in a >>> backwards incompatible manner? Is this because of some XQuery/XPath >>> spec thing? A while ago I switched to 8.6-SNAPSHOT just to be on the >>> latest and greatest and I starting seeing weird things in my code. >>> Initially I didn't bother to look at the docs as I didn't expect >>> map:merge to have changed. At some point I even thought map:merge was >>> broken in this snapshot. I often use map:merge for handling function >>> options and I add the defaults first and then user options. With 8.6 >>> this default behaviour has changed and I would have to switch this >>> around or explicitly ask for 'use-last'. I can do but only by adding >>> map { 'duplicates': 'use-last' }. This means I will have code <= 8.5 >>> and I need to have different code for > 8.5. >>> Was this intentional? If not then I would vote for re-instating >>> default behaviour (use-last). >>> >>> Cheers, >>> --Marc > > > > -- > --Marc
Written for BaseX 8.5. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery