W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2017

RE: implicit option connections

From: Erik Siegel <mailing@xatapult.nl>
Date: Thu, 30 Nov 2017 16:09:13 +0100
To: "'Martin Kraetke, le-tex'" <martin.kraetke@le-tex.de>, <xproc-dev@w3.org>
Message-ID: <001401d369ed$2eedac10$8cc90430$@xatapult.nl>
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 Thursday, 30 November 2017 15:10:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:17:35 UTC