[sc34wg3] CTM draft dtd. 2007-09-09 - Templates

Lars Heuer heuer at semagia.com
Mon Sep 24 09:27:20 EDT 2007


Hi all,

Here some comments against the latest CTM draft, located here:
<http://www.jtc1sc34.org/repository/0905.htm> (again with the annoying
Unicode problem, you have to set the encoding to UTF-8 in your
browser).

In Montréal the committee decided to use the same syntax for
occurrences and binary template invocations:

  # Syntax *before* Montréal:

  mccartney isa person       # Template invocation
    homepage: http://www.mcartney.com/   # Occurrence


  # Syntax *after* Montréal:

  mccartney
    isa: person   # Tpl. invocation
    homepage: http://www.mcartney.com/   # Occurrence


So, a parser has to decide at *each*

  identifier : arg

occurrence if "identifier" is a template or not. If it is a template,
the template is invoked, if it is not a template, an occurrence is
created. So far, so good.

Here the problem:

     example1
        homepage: http://www.example.org/    # Occurrence of type
                                             # 'homepage' with an
                                             # IRI value
     

     # A tpl. definition which creates an association
     # of type 'has-homepage' where '$topic' plays the
     # role 'owner' and the role 'website' is played
     # by a *topic* with the subject locator '$iri'

     def homepage($topic, $iri)
         has-homepage(owner: $topic, website: = $iri)
     end


     example2
        homepage: http://www.example.org/ # Same as example1?
                                          # No, we invoke the
                                          # template!
     

In the previous example it would be impossible to create an occurrence
of type 'homepage' *after* we have a declared a template called
'homepage'.

IMO this is bad. The user gets two different behaviours for the same
syntax. And if the user makes a typo within the template name, the
parser would not claim that error, but create an occurrence silently
(unless the argument cannot be a valid occurrence value).

With the CTM syntax *before* Montreal, the parser would have
detected typos and the user wouldn't have got two different things
within the same syntax.

I propose to make template invocation syntax and occurrence syntax
distinct (again). Either we should go back to the syntax before
Montréal or someone should come up with a better one.

Best regards,
Lars
-- 
http://www.semagia.com



More information about the sc34wg3 mailing list