Re: Revisiting "fixing parameters"

"Henry S. Thompson" <ht@inf.ed.ac.uk> writes:
>> Here's my synthesis of the discussions at the face-to-face:
>
> There's one aspect of this I'm having difficulty reconstructing: 
>
>> 4. If a step has no bindings for any of its parameters options, then
>>    the bindings of the nearest enclosing pipeline are inherited.
>> . . .
>> 6. If a pipeline declares more than one parameters option, then it is
>>    en error to rely on the inheritance; each contained step must specify
>>    a binding for each of its parameter options.
>
> On the face of it those two appear to be inconsistent.

I think we left 6 as an open issue at the f2f and I put a stake in the
ground in this proposal :-).

This works:

  <p:declare-step>
     <p:option name="p1" parameters="true"/>
     ...
     <p:xslt/>
  </p:declare-step>

There's no parameter binding on the XSLT step so it inherits the
bindings passed to its pipeline (in p1).

This does not:

  <p:declare-step>
     <p:option name="p1" parameters="true"/>
     <p:option name="p2" parameters="true"/>
     ...
     <p:xslt/>
  </p:declare-step>

There's no parameter binding on the XSLT step so it should inherit, but
where does it inherit from? Rather than make an arbitrary rule, given that
I think this is an advanced experts only one percent use case, I just
made it an error to leave this ambiguity.

> So if my ex1 above is OK, why isn't this OK too:
>
> <p:declare-step type="p:awk">
>  ...
>  <p:option name="p1" parameters="true"/>
>  <p:option name="p2" parameters="true"/>
>  ...
> </p:declare-step>
>
> <p:declare-step type="p:ex2">
>  ...
>  <p:awk>
>   ...
>  </p:awk>
> </p:declare-step>
>
> <p:ex2>
>   <p:with-option name="p1" select="map{'y' := 'closed'}"/>
>   <p:with-option name="p2" select="map{'x' := 'open'}"/>
>   ...
> </p:ex2>
>
> ?  Is the problem that you don't mean inheritance to be by parameter
> name at all?

You didn't declare the p1 and p2 options on p:ex2 so that example looks
staticly invalid to me.

> [Note that (3) should have p:with-option, not p:with-param, right?]

No, I don't think so. See my reply to Jim.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 512 761 6676
www.marklogic.com

Received on Wednesday, 5 December 2012 17:14:07 UTC