W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2005

Re: Variable references in path expressions

From: Bas de Bakker <bas@x-hive.com>
Date: Tue, 26 Apr 2005 11:53:51 +0200
Message-ID: <426E0FAF.7090902@x-hive.com>
To: Michael Kay <mhk@mhk.me.uk>
CC: Charles Brooking <charles.brooking@research.canon.com.au>, www-ql@w3.org

I cannot see how the formal semantics requires this. In section 4.8.3 on
let expressions, there is no mention of re-evaluating the expression
bound to a variable. A let expression just extends the dynamic
environment of the return expression with the variable bound to the
*value* returned by the first expression. The value is then looked up
multiple times, but this would each time return the same value with the
same nodes (that is: nodes with the same identity).

So in this case the path expression de-duplicates 3 copies of $b and
should return (<b1/>, <b2/>, <b3/>) or an implementation dependent
permutation of it (because the document order of new nodes is
implementation dependent).


Bas de Bakker
X-Hive Corporation

Michael Kay wrote:
>> However, will
>>     let
>>       $a := (<a1/>, <a2/>, <a3/>),
>>       $b := (<b1/>, <b2/>, <b3/>)
>>     return
>>       $a/$b
>> return
>>     (<b1/>, <b2/>, <b3/>, <b1/>, <b2/>, <b3/>, <b1/>, <b2/>, <b3/>)
>> because the expression bound to $b constructs unique elements
>> each time it is evaluated?
> Yes.
>> Or should (<b1/>, <b2/>, <b3/>) be returned?
> No, this would be incorrect. (I can't point you to a discussion of this in
> the spec; I think the formal semantics handles the issue. But it's certainly
> been discussed by the WG and it's my clear understanding that the language
> requires this result.)
Received on Tuesday, 26 April 2005 09:54:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:43:43 UTC