RE: implicit option connections

Hi all,

What about this to satisfy your use case:

Maybe we could add a <p:with-option-map> element that accepts a map(xs:QName, item()) and turns the entries in the map into options?

Erik

> -----Oorspronkelijk bericht-----
> Van: Erik Siegel [mailto:mailing@xatapult.nl]
> Verzonden: donderdag 30 november 2017 16:09
> Aan: 'Martin Kraetke, le-tex' <martin.kraetke@le-tex.de>; xproc-dev@w3.org
> Onderwerp: RE: implicit option connections
> 
> Hi Martin,
> 
> Nice syntactic sugar and might save you quite a lot of keystrokes. But my first
> reaction is:
> * It goes against the normal programming paradigm of passing parameters
> to procedures/functions/methods and therefore makes the language harder
> to learn. Auto-passing options might also give surprising results if you're not
> aware of an option for some step
> * There is a mechanism for passing in a whole bunch of parameters in one
> go in XProc 3: maps.
> 
> So given the excellent alternative I would at this moment advise against it to
> prevent making the language even more away of the mainstream than it
> already is.
> 
> Erik Siegel
> 
> > -----Oorspronkelijk bericht-----
> > Van: Martin Kraetke, le-tex [mailto:martin.kraetke@le-tex.de]
> > Verzonden: donderdag 30 november 2017 11:21
> > Aan: xproc-dev@w3.org
> > Onderwerp: implicit option connections
> >
> > Hi,
> >
> > In XProc 1.0 primary input and output ports are implicitly connected,
> > if no explicit connection is declared. This is very convenient,
> > because you can write more compact code.
> >
> > I wonder if we can have the same feature for options in XProc 3.0? In
> > our pipelines, we use frequently the same set of options. With 1.0 we
> > are forced to declare them explicitely for each step. IMHO, this
> > results in many redundant code lines and makes the pipeline harder to
> read.
> > Therefore, I would propose to specifiy implicit option connections for 3.0:
> >
> > If one or more options are in the scope of a step which expects these
> > options, they should be automatically passed to the step. In this
> > case, it should not be required to declare them explicitely with
> > <p:with-option> unless you want to.
> >
> > The pipeline below provides a brief demonstration of implicitely
> > connected options.
> >
> > <?xml version="1.0" encoding="UTF-8"?> <p:declare-step
> > xmlns:p="http://www.w3.org/ns/xproc"
> >    xmlns:c="http://www.w3.org/ns/xproc-step"
> >    version="3.0">
> >
> >    <p:input port="source">
> >      <p:inline>
> >        <doc>Hello world!</doc>
> >      </p:inline>
> >    </p:input>
> >    <p:output port="result"/>
> >
> >    <p:option name="attribute-name" select="'foo'"/>
> >    <p:option name="attribute-value" select="'bar'"/>
> >
> >    <p:add-attribute match="/doc"/>
> >
> > </p:declare-step>
> >
> > In case, you want to avoid an implicit connection, the easiest way to
> > do so is to declare the option explitely. If you do not want that the
> > option is declared at all, I would suggest to add an empty
> > <p:with-option/> for that step.
> >
> > Please let me know, what do you think about implicit option connections?
> >
> > Kind regards,
> >
> > Martin
> >
> > --
> > Martin Kraetke
> > Lead Content Engineer
> > le-tex publishing services GmbH
> >
> > Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356
> > 143, Fax +49 341 355356 543 martin.kraetke@le-tex.de,
> > http://www.le-tex.de
> >
> > Registergericht / Commercial Register: Amtsgericht Leipzig
> > Registernummer / Registration Number: HRB 24930
> >
> > Geschäftsführer: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt, Dr.
> > Reinhard Vöckler
> 
> 

Received on Friday, 1 December 2017 08:40:11 UTC