Actually most of the symbols in the language don't have names. For example "+" 
doesn't have a name. The */?/+ symbols that can follow an ItemType are 
collectively referred to as OccurrenceIndicators, but they don't have 
individual names. Most of the time we talk about symbols, we refer to them by 
the names of the characters that are used to spell them. The dollar sign that 
prefixes a variable name is just a dollar sign, so I guess that ":=" is just 
"colon-equals".

When you're writing tutorials, documentation, etc, it's always a tough call 
whether to stick rigidly to the terminology of the spec or to introduce terms 
of your own. I'll go either way depending on the merits of the case. Usually I 
try to stick to standard terminology but if the terminology in the spec is 
really bad then I'll introduce something new (for example I reckoned that 
no-one except the most avid spec-readers would know what an error message 
referring to a "transform expression" was talking about, so I called it a 
"copy-modify expression" instead).

Personally I find the distinction between assignment and binding rather 
precious. After all, we use the terms "variable" and "function" in both 
procedural and functional language to mean somewhat different things, and 
no-one minds. When I come to a new language, I find it easier if most of the 
terminology is familiar, even if the properties of the objects or operations 
that the terms refer to are a bit different.

Michael Kay
Saxonica


> On 21 Nov 2016, at 17:40, Joe Wicentowski <[email protected]> wrote:
> 
> Hi Ghislain,
> 
> 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
> expression).
> 
> (For some resources that use the term "assignment operator," see via
> https://www.google.com/search?q=%22assignment+operator%22+xquery.)
> 
> 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?
> 
> Thanks again,
> Joe
> 
>> 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.
> 
> _______________________________________________
> [email protected]
> http://x-query.com/mailman/listinfo/talk


_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk

Reply via email to