-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New circularity tests in prod-VarDecl #167
Comments
I have now got K-InternalVariablesWith-52 to work, but I'm not convinced that the spec guarantees it. |
As we don’t enforce eager evaluation, and we allow processors to optimize the code before evaluating it, I think that the current results for
It would be fine to get the specification rules straight that this one should or must not raise an error. A corresponding paragraph in 5.16 Variable Declaration seems unclear to me (it has not changed since XQuery 3.0):
It says that the graph can be built (i.e., it is optional to build it), but then, that an error must be raised if a cycle exist. Maybe it would be sufficient to say that It does not clarify yet how we want to treat For functions, there is 5.18.6 Recursion, which says:
This section was introduced before function items were introduced to the language and has not been updated since then. Maybe we should include variable declarations? From today’s perspective, the distinction makes no sense anymore. Instead, it should be possible to rewrite the following code snippets (which would run infinitely) to the same identical representation: declare function local:f() { local:f() }; local:f() declare variable $f := fn() { $f() }; $f() |
I believe some of these new tests are incorrect, or at any rate, alternative results are legitimate.
K-InternalVariablesWith-17b expects success. But if the global variable $var1 is evaluated eagerly, evaluation fails with a circularity:
local:func1()
cannot be evaluated because the value depends on $var1.K-InternalVariablesWith-17c -- the only way this can succeed is by recognising that func2() can be evaluated without evaluating its argument, and therefore without evaluating $var.
K-InternalVariablesWith-17d -- ditto.
K-InternalVariablesWith-17e -- ditto.
K-InternalVariablesWith-52 -- I think this can legitimately raise a circularity error.
The text was updated successfully, but these errors were encountered: