[Bug 3305] Cardinality +/* on range variables

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


frans.englich@telia.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED




------- Comment #7 from frans.englich@telia.com  2006-06-07 23:28 -------
I can understand consistency on the grammar level, and hence as a slight
consequence, consistency in implementation approach. But I can't see the
consistency argument from a user's perspective. Sure, the user is free to
specify an occurrence indicator and hence it is consistent with other cases
involving SequenceTypes, but it makes absolutely no sense.

If the user specifies an occurrence indicator, it means one thing: he/she has
misunderstood how the expression works. By silently accepting it, the language
accepts code which does not do what the user expects it do -- the same effect
as for example accepting non-well formed XML. The whole point of error messages
is to avoid this kind of situations.

It wouldn't surprise if a large part of the reluctance is because of the
potential invasive grammar changes. I would agree that the grammar changes are
(easily too) invasive at this stage. I neither think it would be straight
forward, because one cannot simply replace SequenceType with ItemType, since
that would exclude empty-sequence().

However, an alternative is to implement the error on a higher level: "It is a
static error if the declared type allows anything but one item[error code]."
Functionally, it would achieve the same but without an invasive grammar change.

Yes, it would beg for the question "but why does the grammar allow it then?"
and hence make the spec look illogical. I'd say that is easily a worthy
sacrifice, considering that XQuery, which easily will stay for a decade, will
now have a characteristic that users will fall over. Few read the spec, but
very many use the language.

I still neither see why one wouldn't choose to let the type declaration apply
on the sequence as a whole. I would have full understanding for a
consistency-argument in that case(e.g, a sequence type that actually applies to
a sequence), and it wouldn't have the problem of having to make an occurrence
indicator disappear because it would have a purpose.

Nevertheless, I don't re-open because I don't feel I can judge in this matter, 
 because I only know my view on this. However, if anyone who participated on
the teleconference feel that implementing the error on a higher level as
described above could be an acceptable alternative -- do feel free to reopen or
discuss this further.


Frans

Received on Wednesday, 7 June 2006 23:28:16 UTC