>
> We investigated these (and some other) options in depth in
> the WG and finally decided to be pessimistic in the first
> version of the static typing rules to avoid the runtime checks.
>
But of course, you still have to do the run-time checks if the user can only
get the thing to compile by adding a call on exactly-one().
It seems to me that with optimistic typing the process is:
1. At compile time, the system decides that there might be more than one
item, so it generates code to do a run-time check.
2. At run-time, the system checks that the sequence is a singleton.
With pessimistic typing, the equivalent process is:
1. At compile time, the system decides that there might be more than one
item, so it rejects the query.
2. The user edits the query to add a call on exactly-one().
3. At run-time, the system evaluates the call on exactly-one() by performing
a run-time check that the sequence is a singleton.
I think I know which I prefer.
Michael Kay