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

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 UTC