RE: Shadowing of options/variables

> > But you be able to do this:
> >
> >    <p:pipeline>
> >      <p:option name="foo" select="..."/>
> >      <p:group>
> >        <p:variable name="foo" select="..."/>
> >        ...
> >
> > 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.
> 
> There's an ambiguity that was the source of my confusion, and that I'm
> still concerned about:  the environment is a _data structure_, and the
> environment of the p:group in the above example has a binding for 'foo'
> in it from the p:option.  So I thought the first quote above would rule
> out the shadowing.
> 
> If OTOH you read 'environment' as naming a region of the XML tree,
> rooted in the p:group element, then the problem doesn't arise. . .

I must admit I hit the same thing. There indeed is potential ambiguity there as different people may interpret

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

differently. I think the intended way to read the "in the same environment" is "in the very same instance of the environment data structure". In that sense the environment op the p:pipeline and the p:group are different entities. Yes, they share some bindings, but they are different environments.

Vojtech


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

Received on Thursday, 21 February 2013 08:48:45 UTC