Re: unbound option bug in Calabash, I think

"Henry S. Thompson" <ht@inf.ed.ac.uk> writes:

> Norman Walsh writes:
>
>> What about this one?
>>
>>    <p:pipeline xmlns:p="http://www.w3.org/ns/xproc">
>>     <p:option name="notBound"/>
>>     <p:option name="notUsed" select="$notBound"/>
>>     <p:identity/>
>>    </p:pipeline>
>
> Hmm.  The spec says [1]
>
>   "The select expression is only evaluated when its actual value is
>    needed by an instance of the step type being declared."
>
> That puts a pretty substantial burden on an implementation!  Did we
> really mean to say that???!!!! 

No, I don't think so. That paragraph is supposed to tell you that the
select expressions aren't evaluated when the declaration is
encountered, they're evaluated when a step of that type is used.

So, if you had a library that contained:

  <p:declare-step type="my:extension">
    <p:option name="random" select="java:random()"/>
  </p:declare-step>

and a pipeline that contained:

  <my:extension/>
  <my:extension/>

you would not expect each call to my:extension to receive the same
value for the random option (http://twitter.com/codinghorror/status/1803680004
notwithstanding), one computed when the processor read the
declaration.

So I think our spec says explicitly that no error arises if you place
this p:pipeline example in a p:library and import that library.

I'm not sure it contains an explicit answer to the question at hand.

> But given it says that, the answer to
> your question is "no, no error, since the 'notUsed' option is never
> needed by any instance of the step".
>
> Our gun, our foot, our bullet :-(.

I assert that if we had meant to require implementors to handle this
case, we would not have forbidden forward references in variable
declarations. But I've been wrong before.

I think (in addition to clarifying the paragraph that bot you and
Vojtech quoted), we should say either that the $notUsed expression
MUST or MAY produce an error. In the interest of interoperability and
simplicity, I favor MUST, but I'm not going to lie down in the road
about it.

The other interoperable answer is MUST NOT, but that seems to place a
pretty significant burden on implementors for a very small benefit to
pipeline authors.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | Man's sensitivity to little things and
http://nwalsh.com/            | insensitivity to the greatest are the
                              | signs of a strange disorder.-- Pascal

Received on Friday, 15 May 2009 11:55:54 UTC