[sc34wg3] TMCL and MAX_INT

Lars Marius Garshol larsga at garshol.priv.no
Mon Feb 23 06:17:30 EST 2009


* Graham Moore
>
> [(1)] Sounds like lots of work even if we come up with a technical  
> solutions.

Yeah. I don't think this is feasible, really.

> [(2)] This still leaves us in the spec needing to indicate what that  
> value actually is. Also, what does the expansion look like? Doesn't  
> this
> just push the problem around?

I was thinking that if you leave out the max-card occurrence that  
means the maximum is unlimited. Similarly for min-card. It requires us  
to write the TMQL that way, but that should be no problem.

Actually, this is required for (3) to work as well, since otherwise  
how do we specify tmcl:unlimited?

> [(3)] Would this mean that only these topics were allowed, could I  
> introduce a 1-4 card topic and have it understood?

What I was thinking was that we'd basically just move min-card and max- 
card onto these cardinality topics and not make any other changes.  
People could then use the TMCL-defined cardinality topics or their  
own, and they could even duplicate tmcl:unlimited themselves if they  
want to.

> A variant of this would be to store this value in an occurrence  
> whose data type is string and have the semantics of evaluation cast  
> it to an Int even when the value is *.

I guess this is the same as the StrToInt("*") proposal below?

> [(4)] I dont like this due to what is template bloat and makes it  
> seem like there are lot more things for people to learn.

I agree.

> We introduce in CTM some casting functions, so the template would be
>
> ph:photo isa tmcl:topic-type ;
>   plays-role-unlimited(ph:categorized, ph:in-category, 0,  
> StrToInt("*")) .
>
> And we define StrToInt as fundamental functions that have a certain
> behaviour, including for StrToInt a * to be the max int as defined in
> the local system. This is similar to one except its a CTM fix not a
> TMDM one. The bad thing about this is that an actually Int will get
> stored, not a symbol for infinity.

I guess that's really a version of solution (1) that might actually  
work. That is, instead of using

   MAX_INT

we use

   "StrToInt(\"*\")"

and do the necessary TMQL magic to have that work.

Downsides:

  - this is not actually an integer literal, so datatyping is messed up,
  - it's not exactly pretty to write, and
  - it requires a bit of TMQL machinery etc.

--Lars M.
http://www.garshol.priv.no/blog/
http://www.garshol.priv.no/tmphoto/





More information about the sc34wg3 mailing list