[tmql-wg] Proposed requirements: Operations on primitive types
Robert Barta
rho@bigpond.net.au
Tue, 22 Jul 2003 08:20:10 +1000
On Mon, Jul 21, 2003 at 04:33:04PM +0200, Lars Marius Garshol wrote:
> One issue we have not discussed so far is to what extent we should
> support primitive types and operations on them. That is, should a
> query be allowed to interpret internal occurrences as containing
> numbers? Dates?
Lars,
This is a tricky one.
On the one hand the official TM standards so far are oblivious to
typing: except 'string' I cannot remember seeing anything yet, maybe
at some time in TMCL.
On the other hand it is a frequent developer request to add all sorts
of data into a resourceData element. There is no TM-ish way to
indicate _what_ kind of data one adds. For a constraint/template
language it may mean that validation also includes the validation of
content in the resourceDate element. What if this is XML? Should
another validator be launched? Should a DSDL framework (shiver :-) be
used?
What I am saying is that a query language rightfully may take the
stance to ignore typing altogether, even though it is ultimately not
very practical.
> And, if we support this, should we also support operations on these
> values? That is, basic arithmetic functions on numbers like plus,
> minus, multiplication, etc? String operations like those of XPath?
> Date functions? Regular expressions?
What I would imagine is that we include minimal integer arithmetic
(+,-,*,div,mod) and maybe some string functions (length, substring,
concat/join) and use a (perlish) implicit conversion mechanism.
Everything else might be tucked away into 3rd party function libaries.
Maybe there are some suggestions about dates, though, as they appear
quite frequently.
Tricky.
\rho