xproc / 3.0-steps

Repository for change requests to the standard step library and for official extension steps
10 stars 7 forks source link

Question on options with p:run #542

Closed xml-project closed 4 months ago

xml-project commented 1 year ago

The spec says:

Options of the dynamically executed pipeline that are not declared with p:run-option on the p:run invocation will receive an empty sequence as their value.

On a strict reading this suggests to me, that the option receives an empty sequence as their value even if a default value for this option is declared in the called pipeline.

Is this right? If not, what do I miss?

xatapult commented 1 year ago

Hmm. Strictly interpreting this text, I think you're right.

But it sounds completely counter-intuitive to me. So maybe it should read (we'll have to change that):

Options of the dynamically executed pipeline that are not declared with p:run-option on the p:run invocation and that have no default value will receive an empty sequence as their value.

ndw commented 1 year ago

I agree, but why did we mentioned it at all? Given a pipeline with an option myopt run by p:run, if you didn't specify a p:run-option for that option, I'd expect nothing to be passed to the invoked pipeline and for normal defaulting rules to apply.

That would amount to the default value if it had one, the empty sequence if it didn't have one, and possibly a runtime error if the option was required to have a value.

xatapult commented 1 year ago

That would even be better. There must have been some reason we added this clause, but I don't remember. @gimsieke, do you remember why ?

gimsieke commented 1 year ago

We added this because of #534 and this fix for it. And I agree with Norm’s proposed amendment.

ndw commented 4 months ago

We agree that an option that isn't provided should be treated just as if the option hadn't been provided on an ordinary running of the step.