[xquery-talk] XQuery needs to prohibit variable redefinition

Michael Kay mhk at mhk.me.uk
Thu Jul 15 20:22:58 PDT 2004


> 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.

The comment has been made privately and publicly, very forcibly, and has
been rejected on each occasion. The only way I can try to summarise the
rationale is "no needless restrictions" - the language is well-defined if
variable redefinition is allowed, therefore it shouldn't be disallowed.

Michael Kay




More information about the talk mailing list