W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > April 2006

A side-effect example

From: Norman Walsh <Norman.Walsh@Sun.COM>
Date: Thu, 20 Apr 2006 12:07:28 -0400
To: public-xml-processing-model-wg@w3.org
Message-ID: <878xq0nscf.fsf@nwalsh.com>
Here's an example of the pipeline I had in mind on the call today. It
contains only two components: Append and Timestamp.

Append takes two inputs, main and new, and appends them. For example:

main   = <p><foo/></p>
new    = <bar/>
append = <p><foo/><bar/></p>

Timestamp takes no inputs and has no parameters. It returns a document
containing the time of day in seconds. For example:

       = <t>43151</t>

What is the output from this pipeline:

<p:pipeline>
<p:output label="foo"/>

<p:step name="p:timestamp">
  <p:output label="t1"/>
</p:step>

<p:step name="p:append">
  <p:input name="main">
    <doc></doc>
  </p:input>
  <p:input name="new" select="$t1"/>
  <p:output label="a1"/>
</p:step>

<p:step name="p:timestamp">
  <p:output label="t2"/>
</p:step>

<p:step name="p:append">
  <p:input name="main" select="$a1"/>
  <p:input name="new" select="$t2"/>
  <p:output label="a2"/>
</p:step>

<p:step name="p:timestamp">
  <p:output label="t3"/>
</p:step>

<p:step name="p:append">
  <p:input name="main" select="$a2"/>
  <p:input name="new" select="$t3"/>
  <p:output label="$foo"/>
</p:step>

</p:pipeline>

I contend that it makes sense for us to be able to annotate whether or
not components have side effects. If the Timestamp component has such
an annotation then the output will be something like:

  <doc>
  <t>43151</t>
  <t>43153</t>
  <t>43159</t>
  </doc>

If the Timestamp component has no such annotation (or asserts that it
doesn't have side effects) then that could still be the result
(implementations aren't required to cache results). But this would be
an equally valid result:

  <doc>
  <t>43151</t>
  <t>43151</t>
  <t>43151</t>
  </doc>

I think Alex wants the pipeline to express this in some way through
dependencies, but that strikes me as terribly awkward for the poor
user:

<p:pipeline>
<p:output label="foo"/>

<p:step name="p:timestamp">
  <p:output label="t1"/>
  <p:output href="http://example.org/randomuri1"/>
</p:step>

<p:step name="p:append">
  <p:input name="main">
    <doc></doc>
  </p:input>
  <p:input name="new" select="$t1"/>
  <p:input href="http://example.org/randomuri1"/>
  <p:output label="a1"/>
</p:step>

<p:step name="p:timestamp">
  <p:output label="t2"/>
  <p:output href="http://example.org/randomuri2"/>
</p:step>

<p:step name="p:append">
  <p:input name="main" select="$a1"/>
  <p:input name="new" select="$t2"/>
  <p:input href="http://example.org/randomuri2"/>
  <p:output label="a2"/>
</p:step>

<p:step name="p:timestamp">
  <p:output label="t3"/>
  <p:output href="http://example.org/randomuri3"/>
</p:step>

<p:step name="p:append">
  <p:input name="main" select="$a2"/>
  <p:input name="new" select="$t3"/>
  <p:input href="http://example.org/randomuri3"/>
  <p:output label="$foo"/>
</p:step>

</p:pipeline>

Surely it makes more sense to just allow the component to be
identified as unstable.


                                        Be seeing you,
                                          norm

-- 
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Thursday, 20 April 2006 16:07:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:47 GMT