[sc34wg3] TMCL and MAX_INT
Lars Marius Garshol
larsga at garshol.priv.no
Mon Feb 23 06:41:47 EST 2009
* Graham Moore
>
> Have optional params on the templates and in the ctm / tmdm the max is
> simply missing, meaning that its unlimited. I believe the TMQL
> semantics already works along these lines.
>
> This means we need IF in ctm?
If we're going to take this route we need optional params + IF, yes.
So
def plays-role($assoctype, $roletype, $topictype, $cardmin, $cardmax)
?c isa roleplayer-constraint ;
card-min: $cardmin ;
card-max: $cardmax ;
applies-to(?c : constraint-role, $assoctype : assoctype-role) ;
applies-to(?c : constraint-role, $roletype : roletype-role) ;
applies-to(?c : constraint-role, $topictype : topictype-role) .
end
would instead become
def plays-role($assoctype, $roletype, $topictype, $cardmin, $cardmax?)
?c isa roleplayer-constraint ;
card-min: $cardmin ;
if $cardmax
card-max: $cardmax ;
end
applies-to(?c : constraint-role, $assoctype : assoctype-role) ;
applies-to(?c : constraint-role, $roletype : roletype-role) ;
applies-to(?c : constraint-role, $topictype : topictype-role) .
end
Or something like that. Raises tricky questions, though. How do you
work the IF into the existing grammar and at what level? Should there
be AND and OR etc in IF? What happens if you parse something that has
a reference to an undefined variable?
I'm not sure this is a good idea. To me using cardinality topics still
seems like the simplest solution.
--Lars M.
http://www.garshol.priv.no/blog/
http://www.garshol.priv.no/tmphoto/
More information about the sc34wg3
mailing list