[xquery-talk] Typeswitch - scope of variables

Michael Kay mike at saxonica.com
Fri Mar 14 03:54:53 PST 2014

On 14 Mar 2014, at 11:08, Ihe Onwuka <ihe.onwuka at gmail.com> wrote:

> I cannot discern from the specification what the scope of variables
> introduced in the operand expression should be.

Same as in any other expression. E.g. if the operand expression is a FLWOR expression, you go to the rules for a FLWOR expression, e.g. the let clause, and the rules for the let clause say

The scope of a bound variable includes all subexpressions of the containing FLWOR that appear after the variable binding. 

[I think we can read "includes" here as "comprises", i.e. it includes nothing other than these subexpressions]

Clearly the case clauses of the typeswitch are not subexpressions of this FLWOR so they are not within the scope of a variable introduced by such a let clause.

Michael Kay

> Yes I can to see if
> they are but such an experiment would not adjudicate specification
> conformance, would it.
> Fleshing it out for clarification (and possible misinterpretation on
> my part). Since an operand expression can be FLOWR, are any lets
> introduced therein within the scope of the case clauses of the
> typeswitch expression?
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk

More information about the talk mailing list