[tmql-wg] TMQL Issue: Functions and Predicates as first-class topics

Lars Heuer heuer at semagia.com
Sat Mar 10 10:11:14 EST 2007

Hi Robert,

Only some thoughts, no solutions ... :) Some of them may bore you,
because I've already written them in a off-list discussion. :)

- The TM-ish style adds some syntactic noise to functions / predicates
  They can be written with less code. I.e.

  TM-ish style:

      nr_employees isa tmql:function
      tmql:return : {
         fn:length ( $o <- employer)

  Traditional style:

      def nr_employees
          return fn:length ( $o <- employer)

  The same applies to the documentation for the functions: I assume
  that the docs are written as occurrences, too. But this practise is
  more lavish than inventing a special (?) comment syntax which can be
  used for documentation purposes (like Java Doc, Pyhton docstrings

- Slower to parse
  If a parser sees i.e. "def" it knows that it sees a function /
  predicate / template declaration without involving any TM-related
  operation. If TMQL uses the TM-ish style, an user can expect that
  the TMQL-processor accepts something like:

      my-function iko tmql:function

      my-return iko tmql:return

      nr_employees isa my-function
      my-return: {

  To understand that "nr_employees" is TMQL-function causes more work
  for a TMQL processor than the traditional style would.

  The same applies to surrounding tools, like a simple syntax
  highlighter. It would be a bit harder to write a simple syntax
  highlighter without an underlying topic map if everything looks like
  a topic.

- Scope?
  The examples I've seen so far are all in the unconstrained scope.
  What happens if the type-instance relationship is scoped? Under
  which conditions are the functions / predicates are executed?

Best regards,

More information about the tmql-wg mailing list