[sc34wg3] Template parameters in CTM
Robert Cerny
robert at cerny-online.com
Tue Feb 2 03:00:52 EST 2010
On Jan 29, 2010, at 3:30 PM, Lars Marius Garshol wrote:
> Lars Heuer and I are discussing a corner case in CTM, and whether
> it should be legal or not. In other words, we're not discussing
> what the spec says, but what it *should* say. You can see some the
> discussion on
> http://projects.topicmapslab.de/issues/1908
>
> [...]
>
> This is also legal:
>
> def has-psi($t, $psi)
> $t $psi .
> end
>
> foo has-psi( http://en.wikipedia.org/wiki/Isaac_Newton ).
>
> Here, the URI is interpreted as a subject identifier added to the
> topic. Again, no problem.
>
> We could also do this:
>
> foo instance-of( = http://example.org/not-good-modelling ).
>
> Here the parameter is interpreted as a topic referred to by its
> subject locator. Obviously fine. But what about this? (And please
> don't be confused by the name of the template.)
>
> foo has-psi( = http://example.org/some-resource ).
>
> Is this an error because we are passing a topic to $psi, which
> cannot be a topic because of how it's used inside the template, or
> is it OK because we're really passing a subject locator assignment,
> so that it becomes equivalent to:
>
> foo = http://example.org/some-resource .
>
> Thoughts, anyone?
As far as i understand your email and issue 1908, there seem to be
two issues here:
A. Allowing all kind of topic references to be passed to templates,
including references to topics via their subject locators. This would
relieve the topic map author of making the subject locator assignment
explicit.
B. Allowing arguments to have multiple types. has-psi in your example
seems to accept strings and topic references.
I am for strongly A, because if you just want to mention an identity
of a subject you should not have to make a statement about it.
I am not so strongly against B, because it makes reading harder,
although i really appreciate this feature in programming languages
(but mostly as an author). I would be in favor of B if you could
split the template definition over several bodies.
Side note: i really like ctm. It did not take me a long time to get
productive with it. The most frequent syntactical error that i make
usually involves line endings.
Best,
Robert Cerny
Software Development
http://www.cerny-online.com
More information about the sc34wg3
mailing list