[Bug 29080] array:members

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29080

--- Comment #13 from Michael Kay <mike@saxonica.com> ---
We left this open today so we could give it further thought.

I think it's probably true that arrays containing non-singleton members are a
bit tricky to use, and that using arrays rather than sequences as the members
of a "nested collection" is probably a good idea.

Converting an array whose members are sequences to an array whose members are
arrays is easy enough:

array:for-each($in, function($m) { [$m] })

Turning the array of arrays into a sequence of arrays is also easy enough: $a?*

So the proposed function could also be written:

declare function array:members($array as array(*)) as array(*)* {
    array:for-each($in, function($m) { [$m] }) ? *
  };

Where a function has a one-line implementation, we need a very strong
justification to add it to the spec. I think that's particularly true where the
function is the composition of two simple operations that are easily expressed
and likely to be often used in isolation: in this case, turning an array of
sequences into an array of arrays, and turning an array of items into a
sequence of items.

I've been trying to devise use cases, and they all suffer from the syndrome "I
wouldn't start from here": I would start with an array of arrays rather than an
array of sequences. In looking for cases where you would naturally do something
that produces an array of sequences, I can't find any where it wouldn't be
equally easy to produce an array of arrays.

So I'm not convinced of the need.

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

Received on Tuesday, 14 June 2016 17:15:46 UTC