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

[Bug 5795] Static Typing: CVS: K2-Steps-2, K2-FunctionProlog-14

From: <bugzilla@wiggum.w3.org>
Date: Thu, 26 Jun 2008 12:23:05 +0000
To: public-qt-comments@w3.org
Message-Id: <E1KBqVF-0000Mn-18@wiggum.w3.org>

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5795





--- Comment #8 from Tim Mills <tim@cbcl.co.uk>  2008-06-26 12:23:04 ---
Consider:

declare function local:something() as xs:integer 
{
  1
}

(local:something())[928]

Do you think it is reasonable to return () here without evaluating the
function?

If we redefine the functions as:

declare function local:something() as xs:integer 
{
  fn:error()
}

do you still think it reasonable?

As I've said before, I think fn:error should have been treated in the way that
exceptions are treated in Haskell, since the error is a side-effect, and the
same goes for updating expressions.

As I'm sure you are aware, the reason fn:error can't be treated as item()* is
that static type checking would end up with type check errors all over the
place.  e.g.

declare function local:maybe-error($arg as xs:boolean) as xs:integer
{
  if ($arg)
  then fn:error()
  else 1
}

With fn:error() as 'none', this type checks correctly.  Were it item()*, the
call to fn:error would cause a static type check error.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Thursday, 26 June 2008 12:23:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:52 GMT