Re: Syntax noodling

Hi Norm,

Norm Walsh wrote:
> / Jeni Tennison <jeni@jenitennison.com> was heard to say:
> | Yep. I've been playing in my head with having a 'copies' attribute on
> | <p:output> as a shorthand for "tee" and "sink" components: copies="0"
> | would "sink" while copies="2" or more would tee the requisite number
> | of times. But I'm currently undecided whether we really need to draw
> | attention to teeing/sinking at all at the syntax level: doing so
> | provides error checking when outputs get forgotten about, but I don't
> | think a user would forget about an output that they were interested in.
> 
> I want to be able to check that all the outputs are accounted for;
> users make mistakes. But I think we'll either want to do that by
> adding explicit tee components or by allowing multiple refrences to
> the same label to imply a tee. I don't think we'll need to ask the
> user to indicate explicitly the number of copies required.

I'd also like to see multiple references to the same output imply a tee.
Perhaps an output without a label could imply a sink.

My point about a putative copies attribute and error checking is if
you have a pipeline like:

   <p:step name="proc1">
     <p:input ref="..." />
     <p:output label="output1" />
   </p:step>
   <p:step name="proc2">
     <p:input ref="output1" />
     <p:output label="output2" />
   </p:step>
   <p:step name="proc3">
     <p:input ref="output1" />
     <p:output label="output3" />
   </p:step>
   <p:step name="proc4">
     <p:input ref="output2" />
     <p:output label="output4" />
   </p:step>

you can't tell whether the user has made a mistake in referencing
output1 rather than output2 in proc3, or if they really intended it. If
you have implicit tees then it's not an error (an implicit tee is added
so that there are two copies of output1).

A copies attribute (that defaulted to 1) to indicate when a tee was
intended would make the above an error because output1 was used twice
rather than once. If the user really meant proc3 to use output1, they
would add copies attributes as in:

   <p:step name="proc1">
     <p:input ref="..." />
     <p:output label="output1" copies="2" />
   </p:step>
   <p:step name="proc2">
     <p:input ref="output1" />
     <p:output label="output2" />
   </p:step>
   <p:step name="proc3">
     <p:input ref="output1" />
     <p:output label="output3" />
   </p:step>
   <p:step name="proc4">
     <p:input ref="output2" />
     <p:output label="output4" />
   </p:step>

If they actually meant output2 to be used twice, then they would have:

   <p:step name="proc1">
     <p:input ref="..." />
     <p:output label="output1" />
   </p:step>
   <p:step name="proc2">
     <p:input ref="output1" />
     <p:output label="output2" copies="2" />
   </p:step>
   <p:step name="proc3">
     <p:input ref="output1" />
     <p:output label="output3" />
   </p:step>
   <p:step name="proc4">
     <p:input ref="output2" />
     <p:output label="output4" />
   </p:step>

and would get an error because output2 is used once rather than twice,
and output1 twice rather than once.

But as I say, it's just something I was toying with (inspired by similar
functionality in literate programming systems).

Cheers,

Jeni
-- 
Jeni Tennison
http://www.jenitennison.com

Received on Friday, 12 May 2006 10:06:17 UTC