[xquery-talk] a conceptual clarification

Ronald Bourret rpbourret at rpbourret.com
Wed Mar 2 21:04:53 PST 2005


Per Bothner wrote:

>> question here is,  whether Query No. 2 is violative of the rule stated 
>> in para 1 above.
> 
> There is no difference bewteen query 1 and query 2.

The following is from query 2:

   declare function my:square ($x)
   {
     let $x := $x * $x
     return $x
   };

Just to be clear, this is legal because the $x in the parameter 
declaration is in a different namespace / symbol space / whatever you 
call it that the $x in the let statement? But even if this is true, how 
does one decide which $x is returned by the return statement?

Based on this, are the following functions legal or illegal?

    declare function foo()
    {
       let $x := 1
       let $x := 2
       return $x
    }

    declare function bar()
    {
       let $x := 2
       let $x := $x * $x
       return $x
    }

I must admit to some confusion here...

-- Ron



More information about the talk mailing list