[sc34wg3] TMCL discussions

Lars Heuer heuer at semagia.com
Wed Mar 25 14:59:21 EDT 2009


Hi Lars,

[...]
> Lars Heuer: please look closely at slides 7[1] and 35.

Slide 7: See my answer to Grahams e-mail.

Slide 35 "Overloading of CTM templates":

I think it is possible and does not effect the CTM syntax in any way,
the necessary changes to CTM would not be big. We just have to take
the number of parameters into account. Actually, I rarely missed
function overloading in languages like, say Python. In almost all
cases you can replace the overloading of functions with default
parameters, so default parameters and keyword assignments might be an
alternative. Actually, an unpublished TM syntax (Snello) provides
default values and keyword assignments.

Example of a template:

        has-occurrence($topic, $type, $min=1, $max=INF) :-
            # bla bla
        .

Possible invocations:

        topic-x
           has-occurrence(website).

        topic-y
          has-occurrence(website, $max=>1)  # The $-prefix is optional

        topic-z
          has-occurrence(website, min=>2)   # Without $-prefix


Personally, I find keyword assignments and default values more useful
(maybe that's the reason why Snello provides it ;)), but I can also
see a value in template overloading which would not require changes to
the CTM syntax, while kw-assignments/default-values would change the
syntax and would open the door for proposals to leave out the
parenthesis for template invocations which would require again an
overhaul of CTM.


Conclusion: I wouldn't mind if CTM provides template overloading and I
think I'd use it, but I think I could live without template
overloading.

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



More information about the sc34wg3 mailing list