[xquery-talk] XQuery needs to prohibit variable redefinition
per at bothner.com
Thu Jul 15 11:39:36 PDT 2004
The most common beginner confusion in XQuery is confusion
about variables, definitions, and assignments. Here is the
let $x := 0
for $y in ...
let $x := $x + ...
One way to reduce this problem is to prohibit defining variables
with the same name. We should follow Java's lead here: A variable
may not be defined within the lexical scope of another variable
with the same name. That will almost be an error. It's not necessarily
just a beginner's mistake - it also hides hard-to-find bugs. That
is why Java prohinits redefinitions.
Of course this would have to formulated as an official public comment,
and it is rather late in the process to make such a mjor change. But
our experience on this list shows we need to do something.
per at bothner.com http://per.bothner.com/
More information about the talk