[xquery-talk] a conceptual clarification

Jason Hunter jhunter at xquery.com
Fri Mar 4 14:02:35 PST 2005


Amitabh Ojha wrote:

> It is evident now  that  it is a bad practice to have two let 
> statements, one after the other, define a variable  with the same name,  
> as  is  cited  in the following example  (even if it is not illegal as 
> per XQuery Specs)
> 
> let $x := ……
> let $x := ……

I'm one of the crowd that finds that construct very useful.  It's 
particuarly useful when massaging a variable from one form to another in 
a series of steps.  It's more elegant than faking $x0 $x1 $x2 $x3.

I can understand the argument that it can be confusing to people, but so 
is functional programming in general.  If we go down the "it can be 
confusing" path, the next logical step is to make the following work 
because it's not working sure is confusing to people:

declar function x() {
   return 5
};

Then after that we may as well make XQuery into a procedural language.  :)

-jh-



More information about the talk mailing list