Re: Language construct syntax

/ Jeni Tennison <jeni@jenitennison.com> was heard to say:
| For-each, choose, viewport (and group) are all special because if we
| tried to describe them as components, we would need to pass in pipelines
| as one or more of the inputs. I'm going to use pipeline="yes" to
| identify such inputs in the following discussion.

What you've outlined is certainly logical, but I just don't think of
the "body" of these constructs as pipelines passed as an input. And
I'm really reluctant to start describing them that way.

| If we were to define them as components, this is what they'd look like.

Indeed, but these are language constructs and we don't have to define
them as components.

In my mind, run of the mill components like XSLT or XInclude are black
boxes that have inputs and outputs. How they function, what they do,
is irrelevant for the purposes of describing the pipeline.

Language constructs like for-each and choose have two aspects. From
the outside, they're black boxes that have inputs and outputs (and an
irrelevant function). From the inside, they have inputs and outputs
and a body, a subpipline, that allows the pipeline author to describe
what they do in terms of other black boxes.

It feels awkward to me to try to describe the body as an input to some
more general definition of a component. Given:

  <choose name="branch" ref="some!document">
    <when test="//a">
      <declare-output port="out1" ref="a!b"/>
      <declare-output port="out2" ref="c!d"/>
      ...steps...
    </when>
    <when test="//b">
      <declare-output port="out1" ref="e!f"/>
      <declare-output port="out2" ref="g!h"/>
      ...steps...
    </when>
    <otherwise>
      <declare-output port="out1" ref="i!j"/>
      <declare-output port="out2" ref="k!l"/>
      ...steps...
    </otherwise>
  </choose>

I think it's component declaration is simply:

  <component name="branch">
    <declare-output port="out1"/>
    <declare-output port="out2"/>
  </component>

                                        Be seeing you,
                                          norm

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

Received on Wednesday, 16 August 2006 14:47:36 UTC