[xquery-talk] XQuery needs to prohibit variable redefinition

Per Bothner per at bothner.com
Thu Jul 15 18:59:38 PDT 2004

Daniela Florescu wrote:

> Otherwise, if we do disallow it, the next comment that we'll have from  
> customers
> will be: "so why can't I write :"
> for $i in ...
> let $i := $i +1
> We will just shift the problem in a different place, but the problem of
> understanding what the LET is/does still remains.

Right.  But that can be answered by a link to an FAQ (perhaps even
directly in the error message).

The alternative is to have the compiler silently accept bad code,
them be mystified why it doesn't work, and either giving up in
frustration, thinking the implementation is buggy, or asking "why
doesn't my program work"?  The support burden for vendors / the
XQuery community *and* the frustration level of users will probably
be much higher.  It's easier/cheaper for a support person to explain a
syntax error than it is to debug a program that silently doesn't work.

As the most recent "why doesn't this work" show, dis-allowing
redefinitions will not catch all errors due to this misunderstanding,
but it will catch the majority, I think.  And that will asve us a lot
of grief in the long run.

 > But you should try again to raise the issue in the second Last Call.
 > I think it will have serious chances this time.

I'll try, as soon as I see the next draft (which I gather should
be soon).
	--Per Bothner
per at bothner.com   http://per.bothner.com/

More information about the talk mailing list