RE: Shadowing of variables..

Hi,

The 5.7 part makes a comparison with XSLT. In XSLT you cannot have
duplicate declarations for params, but you can redeclare variables as
often as you like even straight below each other. It is more convenient to
allow that. I see no obvious reason why to be picky about it, and require
developers to use a p:group to shadow a variable..

But perhaps that is just my pragmatic way of looking at it.. ;-)

Kind regards,
Geert

-----Oorspronkelijk bericht-----
Van: vojtech.toman@emc.com [mailto:vojtech.toman@emc.com]
Verzonden: maandag 28 november 2011 10:15
Aan: xproc-dev@w3.org
Onderwerp: 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 10:12:43 UTC