- From: <bugzilla@jessica.w3.org>
- Date: Fri, 02 Oct 2015 09:14:51 +0000
- To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=4378 --- Comment #13 from Tim Mills <tim@cbcl.co.uk> --- (In reply to Josh Spiegel from comment #12) > Thanks for the clarification Tim. I agree that none isn't ideal because it > leaves the possibility that static analysis and optimizations hide the error > condition. Since it never makes sense to use the context item of the > function body, why not raise a static error when an expression depends on it? > > While playing around with this idea, I noticed tests try-016 and try-017: > https://github.com/LeoWoerteler/QT3TS/blob/ > a2a6b9dc40fbcd5db7a41f927c038b1b1880c489/prod/TryCatchExpr.xml#L215 One could certainly argue that both of these tests should accept XPTY0004, on the grounds that the static type of "." is absent. > Wouldn't a static error be more helpful to the user in both these cases? It > would be a backwards compatibility issue to force it at this point, but > allowing it might be nice... Yes. Formal semantics normalized "." to a variable reference $fs:dot. A reference to an out-of-scope variable would raise static error [err:XPST0008]. Perhaps this error could or should have also applied in this case. I can't think of an example where it wouldn't have been helpful to the programmer to point out the error early. Consider: declare function local:use-dot($yes) { if ($yes) then . else "not dot" }; On invocation of local:use-dot, - If use of out-of-scope "." were a static error S, all implementations would raise S. - If use of out-of-scope "." were a type check error T: * implementations performing pessimistic static type checking would raise T. * implementations performing optimistic type checking or dynamic type checking would raise T in the event that $yes is true. - If use of out-of-scope "." is not a type check error, but XPDY0002 (the status quo), implementations would only raise XPDY0002 at run time when $yes is true. To be honest, I don't understand the reason for the restriction anyway. Consider why declare function local:use-dot() { . }; local:use-dot() is bad, but declare variable $dot := .; declare function local:use-dot() { $dot }; local:use-dot() is fine. -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Friday, 2 October 2015 09:14:59 UTC