← Back to team overview

zorba-coders team mailing list archive

Re: [Merge] lp:~zorba-coders/zorba/bug-1029836 into lp:zorba

 

> Hi Matthias,
> I submitted a new merge proposal following Chris's request.
> Regarding your question, I am not certain it is a type error. In the context
> of dynamic function call, it makes sense that it is a type error (XPTY0004)
> because it is a mismatch between the type of the function produced by the base
> expression and the number of provided parameters. However, in the context of
> object/array selection (with exactly one selector parameter), I am under the
> impression that this is not a type issue, but a dynamic issue (since we
> decided object/arrays do not match function types). What do you think?

I think it should be a type error for the following reason:

The JSONiq spec says

- An object matches the function type function(xs:string) as item()?.
- An array matches the function type function(xs:integer) as item()?.

The XQuery spec defines "During evaluation of an expression, it is sometimes necessary to determine whether a value with a known dynamic type "matches" an expected sequence type. This process is known as SequenceType matching." Further, the spec says "The rules for SequenceType matching compare the dynamic type of a value with an expected sequence type." All errors raised during sequence type matching are type errors.

This seems to be exactly what is being done for object and array selectors.

What do you think?


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1029836/+merge/117250
Your team Zorba Coders is subscribed to branch lp:zorba.


References