Re: A side-effect example

Norman Walsh wrote:
> 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>

Considering that there are three separate steps that us
the 'p:timestamp' component, this makes perfect sense.

For me, it is unclear what is the input for each of these
steps.

> 
> 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>

But the output *isn't* a side effect.  It is the output.  You have three
separate steps, each of which produce some output, and as such, this
doesn't make sense unless they run at exactly the same time.

> 
> 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>

I still don't understand this pipeline.

I'm finding it hard to interpret this XML structure when we haven't
defined semantics.  I'm going to post three flow graphs that relate
to this example that I hope will make things more clear, at least,
to me.  :)

-- 
--Alex Milowski

Received on Monday, 24 April 2006 20:58:10 UTC