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 Monday, 6 October 2014 22:54:37 UTC