W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2011

RE: Shadowing of variables..

From: <vojtech.toman@emc.com>
Date: Mon, 28 Nov 2011 04:15:13 -0500
To: <xproc-dev@w3.org>
Message-ID: <3799D0FD120AD940B731A37E36DAF3FE33FBDB8FB2@MX20A.corp.emc.com>
>   "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:variable name="myvar" select="2"/>

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

  <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.


Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
Received on Monday, 28 November 2011 09:16:06 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:17:01 UTC