W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > February 2013

Shadowing of options/variables

From: Toman, Vojtech <vojtech.toman@emc.com>
Date: Wed, 20 Feb 2013 11:22:27 -0500
To: "public-xml-processing-model-wg@w3.org" <public-xml-processing-model-wg@w3.org>
Message-ID: <F3C7EBECE80AC346BE4D1C5A9BB4A41F2F4D488C3E@MX11A.corp.emc.com>
I took a look at the spec and the test suite and what looks as potentially contradictory prose in the spec (section 2.9: "Variables and options share the same scope and may shadow each other." vs. section 3.2: "That is, no option or variable may lexically shadow another option or variable with the same name.") is, I think, actually correct.

You should not be able to do things like:

     <p:option name="foo" select="..."/>
     <p:variable name="foo" select="..."/>

But you be able to do this:

     <p:option name="foo" select="..."/>
       <p:variable name="foo" select="..."/>

I think both follows from the spec, and the test suite confirms that, although it does not cover all scenarios. See tests err-s0004-003.xml, err-s0004-004.xml, variable-006.xml, and variable-007.xml. (What is missing are tests that demonstrate shadowing of options by variables.)

The key point about section 3.2 is that it forbids declaring options/variables with the same name *in the same environment*, but not in different environments.

So that is good: the spec already supports variable/option shadowing.


Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
Received on Wednesday, 20 February 2013 16:23:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:32:51 UTC