W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2016

[Bug 29080] array:members

From: <bugzilla@jessica.w3.org>
Date: Fri, 10 Jun 2016 14:37:39 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29080-523-BqHZwKFXJa@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29080

Josh Spiegel <josh.spiegel@oracle.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |josh.spiegel@oracle.com

--- Comment #5 from Josh Spiegel <josh.spiegel@oracle.com> ---
I think this function would lead to surprising results in cases where there is
not implicit flattening/atomization.  For example:

  let $arr := [1, 2, (), 4]
  return
    array {
      for $i in array:members($arr)  
      where not(empty($i))
      return 
        $i
    }

I might expect this to filter empty values from the array.  But actually it
would evaluate to [[1],[2],[()],[4]]

You are right that we have made changes recently to the functions and
operators.  We added array:put and modified the signature of array:remove and
map:remove.  In these cases, the modifications were low-risk and
straightforward changes that addressed usability problems.  While I have some
sympathy for the problem you are trying to solve, I am not convinced that this
is the right way to solve the problem. And, as you point out, users can
effectively iterate array members using 1 to array:size().

  let $arr := [1, 2, (), 4]
  return
    array {
      for $i in 1 to array:size($arr)  
      where not(empty($arr($i)))
      return 
        $i
    }

==>

   [1, 2, 4]

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Friday, 10 June 2016 14:37:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:58:00 UTC