joewiz at gmail.com
Mon Nov 21 09:40:26 PST 2016
Thanks very much for your reply! If ":=" is not an "operator," by
your helpful definition, then is there a category like "symbol,"
"delimiter," or at worst, "thingy," that it *does* rightly belong to?
I'm looking to fill in the blank in the following sentence, which
builds on your summary:
":=" has no formal name in the XPath and XQuery specifications but
is used extensively in clauses and declarations that bind variables.
Specifically, it is used in let and group-by clauses (which produce
tuples) as well as variable and context item declarations (which
contribute to the dynamic context). Rather than leaving this important
symbol nameless, let's call it the "binding ____."
I'm also thinking of a parenthetical note or footnote like this:
You may find some resources that somewhat misleadingly define ":="
as the "assignment operator," a phrase that is not found in any XQuery
or XPath specification. Calling ":=" the "assignment operator" is
incorrect in two respects. First, ":=" is involved in the *binding*,
not *assigning*, of values to variables—an important distinction in
functional and declarative languages like XQuery, in which a variable,
once bound to a value, cannot be altered, or reassigned a different
value. Second, the ":=" cannot be described as an *operator* because
it does not produce an output sequence of items, in contrast to
operators like "+" (an arithmetic operator), "and" (a boolean
operator), and "/" (an operator for connecting steps in a path
(For some resources that use the term "assignment operator," see via
It's funny, "/" didn't have a name in XPath 1.0, but got one in XPath
3.0 - "path operator." Perhaps it's time for ":=" to get a name?
> Syntactically, ":=" is not an operator because it does not produce an output
> sequence of items like "+" or "and" or "/". It is part of let and group-by
> clauses (which produce tuples) as well as variable and context item
> declarations (which contribute to the dynamic context).
> From a pedagogical perspective, I would simply call it a variable binding,
> the important part being not to call it "assignment" to make clear that it
> is a functional and declarative language.
More information about the talk