W3C home > Mailing lists > Public > public-qt-comments@w3.org > April 2014

[Bug 25445] [XP3.1] Replace curly array constructor with a function

From: <bugzilla@jessica.w3.org>
Date: Fri, 25 Apr 2014 14:47:17 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-25445-523-QWK3dXFqGY@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=25445

--- Comment #2 from Michael Kay <mike@saxonica.com> ---
I did not intend to reopen the discussion about the semantics of [a,b,c]. I
think we got it right in Prague: it creates an array with three members, these
being the values of a, b, and c. I think that's what most people would expect,
as we discussed in Prague many languages have such a construct and they
invariably create an array with N+1 members where N is the number of commas. We
can't do this with a function call unless it is a variable-arity function call.

I'm concerned here with the other construct, array{X}. I want to understand
whether there is a good reason for having custom syntax for this, rather than
using a function call as we do with its inverse, seq(X).

I see this being used in situations like

array {
  for $x in employee
  return $x/salary/data()
}

and perhaps this is why curlies were chosen; the FLWOR looks more like a
statement than an expression to people from other cultures, because of its
sentential syntax, and in those cultures curly braces are used to group
"statements". But that's not our culture; we have an expression language, and
array{} is semantically a pure function call. Making it a pure function allows
things like

(a/b/c) => array()

which people will increasingly expect to be able to write.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Friday, 25 April 2014 14:47:18 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:46 UTC