- From: Norm Tovey-Walsh <norm@saxonica.com>
- Date: Wed, 21 Sep 2022 07:56:20 +0100
- To: Michael Kay <mike@saxonica.com>
- Cc: public-xslt-40@w3.org
- Message-ID: <m2y1udb47l.fsf@saxonica.com>
Michael Kay <mike@saxonica.com> writes: > The following possibilities come to mind. […] > (c) redefine array:filter with the signature in (a), and extend the > rules for function coercion so that if an arity-1 function is supplied > where an arity-2 function is expected, the supplied value for the > second argument is dropped. This is in fact already proposed at > https://qt4cg.org/specifications/xquery-40/xpath-40-diff.html#id-function-coercion > - see bullet 2. > > I propose we go with (c). That sounds good to me. > Note that the filter function for arrays (and presumably for > sequences) will have arguments ($value, $index), whereas the proposal > for map:filter is for the arguments to be ($key, value). It might be > more considered more consistent to make the map:filter callback expect > ($value, $key), but my preference is to go with ($key, $value) because > this is the order in map:for-each(). It’s impossible to make all of the signatures consistent, so users will have to learn where the sharp edges are. I don’t feel strongly about this, but let me make a brief argument for the other order. I think it’s more likely that I’ll think of array:filter and map:filter as “doing the same thing”, so I think I’ll make fewer mistakes if the map:filter order is ($value, $key), consistent with array:filter. Be seeing you, norm -- Norm Tovey-Walsh Saxonica
Received on Wednesday, 21 September 2022 07:02:23 UTC