RE: ACTION A-227-01 (Variable shadowing)

> "Toman, Vojtech" <vojtech.toman@emc.com> writes:
> > I would say that an (p:)option cannot shadow another
> > (p:)option/(p:)variable, but that (p:)variable can shadow both
> > (p:)option and (p:)variable.
> 
> Why the distinction?

Because I cannot think of an example where p:option could shadow a p:variable. The p:option element occurs only in step declarations and - in the case of pipelines that allow also p:variable - always comes before any p:variable.

> 
> > Also note a small problem with the current wording ("its scope
> > consists of the sibling elements that follow its declaration and the
> > descendants of those siblings") and p:option. Consider the following
> > pipeline:
> >
> > <p:pipeline>
> >   <p:option name="opt"/>
> >   <p:pipeline type="...">
> >     <p:option name="opt"/>
> >     ...
> >   </p:pipeline>
> >   ...
> > </p:pipeline>
> 
> We have special rules for p:pipeline:
> 
>   Irrespective of the context in which the p:declare-step occurs,
>   there are initially no option or variable names in-scope inside a
>   p:declare-step. That is, p:option and p:variable elements can refer
>   to values declared by their preceding siblings, but not by any of
>   their ancestors.

OK. That's probably good enough. I think I also missed the "unless otherwise specified" bit in 3.2.

> 
> I don't think option shadowing is really a thing because there are no
> compound steps with options. This is the canonical example, I think:
> 
> <p:pipeline>
>   <p:option name="opt"/>
>   <p:group>
>     <p:variable name="opt"/>
>     ...
>   </p:group>
>   ...
> </p:pipeline>

Yes, I agree.

> 
> > The nested p:pipeline (sibling of the p:option) has a descendant
> > p:option with the same option name. Obviously, this should work just
> > fine as there is no shadowing in this case, but one might get the
> > impression that this is not allowed.
> 
> I thought this erratum was clear:
> 
> http://www.w3.org/XML/XProc/docs/xproc-proposed-errata.html#e-13
> 
> But I could be wrong.

I think the erratum addresses a different issue than I had in mind, but I don't think I have it anymore (the issue, not my mind).

Vojtech

Received on Tuesday, 7 October 2014 14:15:23 UTC