W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2010

[Bug 10555] Pattern matching proposal for XQuery

From: <bugzilla@jessica.w3.org>
Date: Mon, 06 Sep 2010 20:00:52 +0000
To: public-qt-comments@w3.org
Message-Id: <E1Oshs4-0003pL-OU@jessica.w3.org>

--- Comment #4 from Pavel Minaev <int19h@gmail.com>  2010-09-06 20:00:52 ---
I think it's a very neat twist, actually. I can think of quite a few cases from
past experience where the ability to do a simple check against a pattern would
be handy; in my original proposal, this is possible with a two-branch "match",
but overly verbose. In contrast, the [|pattern|] syntax is nicely composable,
especially if added as another option to FilterExpr, so that it can be used in
paths in lieu of [], like so:


So it wouldn't really be a boolean expression then, but you could combine it
with exists(), or just rely on effective boolean value, to get the desired

    if ($node[|foo//bar|]) then ...

And then, as Michael notes, you could still have "match", just require case
expressions to be pattern expressions (on grammar level):

    match ($node)
    case [|foo|] return 1
    case [|foo/bar|] return 2
    case [|*[@baz]//text()|] return 3
    default return 4

Aesthetically, it also has a nice look to it that blends well with the use of |
in patterns:


Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Monday, 6 September 2010 20:00:54 UTC

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