RE: ACTION A-227-01 (Variable shadowing)

I would say that an (p:)option cannot shadow another (p:)option/(p:)variable, but that (p:)variable can shadow both (p:)option and (p:)variable. 

Also note a small problem with the current wording ("its scope consists of the sibling elements that follow its declaration and the descendants of those siblings") and p:option. Consider the following pipeline:

<p:pipeline>
  <p:option name="opt"/>
  <p:pipeline type="...">
    <p:option name="opt"/>
    ...
  </p:pipeline>
  ...
</p:pipeline>

The nested p:pipeline (sibling of the p:option) has a descendant p:option with the same option name. Obviously, this should work just fine as there is no shadowing in this case, but one might get the impression that this is not allowed.

Vojtech

> -----Original Message-----
> From: Norman Walsh [mailto:ndw@nwalsh.com]
> Sent: Tuesday, October 07, 2014 12:54 AM
> To: public-xml-processing-model-wg@w3.org
> Subject: ACTION A-227-01 (Variable shadowing)
> 
> This action asked me to review variable/option scope/shadow language and
> test cases.
> 
> As Henry observes in http://www.w3.org/2013/02/20-xproc-minutes.html
> the spec says:
> 
>   Variables and options share the same scope and may shadow each other.
> 
> Later, the spec says:
> 
>   The scope of option and variable names is determined by where they
>   are declared. When an option is declared with p:option (or a
>   variable with p:variable), unless otherwise specified, its scope
>   consists of the sibling elements that follow its declaration and the
>   descendants of those siblings. It is a static error (err:XS0004) if
>   an option or variable declaration duplicates the name of any other
>   option or variable in the same environment. That is, no option or
>   variable may lexically shadow another option or variable with the
>   same name.
> 
> And these do seem to be contradictory statements. The intent, I assert, is
> that variables and options may shadow each other, but they may not shadow
> any preceding siblings.
> 
> We have a test cases that defined that position:
> 
>   http://tests.xproc.org/tests/required/variable-007.xml
> 
> and
> 
>   http://tests.xproc.org/tests/required/err-s0004-001.xml
>   http://tests.xproc.org/tests/required/err-s0004-003.xml
> 
> I propose the following erratum to fix this issue:
> 
>   The scope of option and variable names is determined by where they
>   are declared. When an option is declared with p:option (or a
>   variable with p:variable), unless otherwise specified, its scope
>   consists of the sibling elements that follow its declaration and the
>   descendants of those siblings. It is a static error (err:XS0004) if
>   an option or variable declaration duplicates the name of any other
>   option or variable among its preceding siblings.
> 
>                                         Be seeing you,
>                                           norm
> 
> --
> Norman Walsh
> Lead Engineer
> MarkLogic Corporation
> Phone: +1 512 761 6676
> www.marklogic.com

Received on Tuesday, 7 October 2014 08:22:26 UTC