Defaulting and syntactic shortcuts

When we first started working on XProc, I was strongly opposed to any
discussion of defaulting or syntactic shortcuts. Mostly this was
because I didn't want our design decisions to be motivated by
affection for a particular shortcut syntax.

But it was also because, as a language designer, I'm not sure
syntactic shortcuts are a good idea. Perl's "more than one way to do
it" philosophy not withstanding, I think a language is easier to learn
and understand if there is, in fact, at most one way to accomplish any
given task. Giving users more than one way to do it means users have
to learn more than one language.

So my initial principle was: no defaulting.

Time passed, the glaciers advanced and receded, eventually we decided
to allow some defaulting for connections between consecutive steps.

Then my principle was: no defaulting, except for this one case.

Then we added a syntactic short cut for option values, and more
defaulting for connections, and defaulting for parameters, and
eventually we made this a meaningful pipeline:

  <p:pipeline xmlns:p="...">
    <p:identity/>
  </p:pipeline>

(Something about which I am not without reservations, but that's
neither here nor there.)

Now I have no principle on which to base my reluctance to accept the
merits of a particular syntactic shortcut or default. And
unfortunately, this far down the slippery slope, I see nothing but
smooth sailing ahead:

1. Why not allow AVTs in option/parameter values? This would,
   arguably, simplify the language. It would increase the value of the
   attribute syntax shortcut for option values and allow us to get rid
   of the distinction between @value and @select on p:parameter and
   p:option. (What is currently done with @select could be done with
   an AVT in @value.)

2. Consider:

   <p:input port="source">
     <p:document href="foo.xml"/>
   </p:input>

   Isn't this an obvious syntactic convenience?

   <p:input port="source" href="foo.xml"/>

3. Consider:

   <p:input port="source">
     <p:pipe step="stepname" port="portname"/>
   </p:input>

   Isn't this an obvious syntactic convenience?

   <p:input port="source" step="stepname" port="portname"/>

4. Consider:

   <p:input port="source">
     <p:inline>
       <some-root>...</some-root>
     </p:inline>
   </p:input>

   Isn't this an obvious syntactic convenience?

   <p:input port="source">
     <some-root>...</some-root>
   </p:input>

I don't really want to make any of these changes, but I don't know
what argument against them hasn't already been lost.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | Nature is amoral, not immoral. [It]
http://nwalsh.com/            | existed for eons before we arrived,
                              | didn't know we were coming, and doesn't
                              | give a damn about us.--Stephen J. Gould

Received on Tuesday, 17 July 2007 12:32:27 UTC