RE: Shadowing of variables..

>   "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."
> 
> What's "the same environment"?  How does it differ from "the same
> step"?  Surely we want user-defined steps to be "seperate"
> environments.

Good observation. I think I interpreted "the same environment" as "the same scope", but this is probably not correct at all. And you are probably right that "the same environment" can be read as "the same step" - on the "outside" of the steps this is trivial, and for the "inherited environment" inside of container steps it follows from the rules in 2.5.

So given the above, Geert's example should work, because the variables are in two different environments:

<p:variable name="myvar" select="1"/>
<p:group>
  <p:variable name="myvar" select="2"/>

However, the following will not work because "myvar" is duplicated in the same environment:

<p:group>
  <p:variable name="myvar" select="2"/>
  <p:variable name="myvar" select="3"/>


> That seems to me to be a bug in Calabash

And in our implementation as well. Seems like we need to add a test to the XProc test suite.

Thanks,
Vojtech


--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

Received on Monday, 28 November 2011 09:16:06 UTC