W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2008

[Bug 5459] [FS] Static type analysis for the fn:abs, fn:ceiling, fn:floor, fn:round, and fn:round-half-to-even functions

From: <bugzilla@wiggum.w3.org>
Date: Sat, 16 Feb 2008 05:09:07 +0000
To: public-qt-comments@w3.org
Message-Id: <E1JQFIR-0006AT-CP@wiggum.w3.org>


------- Comment #6 from jmdyck@ibiblio.org  2008-02-16 05:09 -------
(In reply to comment #5)
> I think it may be sufficient just to consider the types making up the union of
> the prime type, and not all combinations thereof.

I'm not sure exactly what you're suggesting. E.g, at first I thought you meant
    Get the prime type, call convert_untypedAtomic, then for each
    item type, find the least type (in the set of target types)
    that it can be promoted to, and take the union of those types.
That would work for my example, but in general it doesn't ensure that the
argument types are compatible. E.g., it should (but doesn't) fail to infer a
type when the arg type is (integer|date)*.

> With all these functions it is only possible to get a particular return type
> if one of the arguments is of that type - for example fn:min only returns
> xs:double if at least one argument is of type xs:double (or a type deriving
> from xs:double)

(or xs:untypedAtomic) Also, that observation isn't quite true for fn:avg -- it
returns xs:decimal even when all the args are xs:integer.

> This way the static typing rules are directly analogous to those given in
> section C.2 for overloaded functions.

The rules in C.2 should be taken with a grain of salt. They have some bugs that
haven't been reported yet.
Received on Saturday, 16 February 2008 05:09:28 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:35 UTC