Hi Christian,
I’ve addressed this issue already in feb 2022 and nov 2020. Since I think it is a bug I am coming back on it again. Hopefully with a better formulated argument this time. There is a easy workaround but if code is generated, as in my case, having to change the code manually each time after generation is getting pretty tedious. (and I very much like my code to be consistent)
So, why is it that a function-declaration of a function that is recursive doesn’t trigger an self-depending-error and a variable-declaration that has such a function assigned to, does? In the first situation preventing an endless loop is, obviously and rightly so, treated as a programmers responsibility. However in the second situation this responsibility is taken away from the programmer by not even allowing the situation. This is not consistent. Sure, the compiler should and does detect cyclic variable-assignments but that is actually not the case here. Assigning a function to a variable is per definition a non-cyclic assignment. Possible recursiveness in this case should be treated the same as with a function-declaration, that is, as a programmers responsibility.
I hope the above makes some sense. Is it worth an effort to address this issue? It would probably make the compiler code even less complex.
Cheers, Rob Stapper
Sent from Mail for Windows
Hi Rob,
Your arguments are fine. I can confirm that the current behavior is buggy.
It's mostly due to limited resources that we haven't tackled this so far. We're spending a lot of time on implementing XQuery 4 features. Next, commercial requests need to be given priority.
Sorry for that.
Best, Christian
Rob Stapper r.stapper@lijbrandt.nl schrieb am Di., 12. Sept. 2023, 11:11:
Hi Christian,
I’ve addressed this issue already in feb 2022 and nov 2020. Since I think it is a bug I am coming back on it again. Hopefully with a better formulated argument this time. There is a easy workaround but if code is generated, as in my case, having to change the code manually each time after generation is getting pretty tedious. (and I very much like my code to be consistent)
So, why is it that a function-declaration of a function that is recursive doesn’t trigger an self-depending-error and a variable-declaration that has such a function assigned to, does? In the first situation preventing an endless loop is, obviously and rightly so, treated as a programmers responsibility. However in the second situation this responsibility is taken away from the programmer by not even allowing the situation. This is not consistent. Sure, the compiler should and does detect cyclic variable-assignments but that is actually not the case here. Assigning a function to a variable is per definition a non-cyclic assignment. Possible recursiveness in this case should be treated the same as with a function-declaration, that is, as a programmers responsibility.
I hope the above makes some sense. Is it worth an effort to address this issue? It would probably make the compiler code even less complex.
Cheers,
Rob Stapper
Sent from Mail https://go.microsoft.com/fwlink/?LinkId=550986 for Windows
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient Virus-free.www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient <#m_5093193444413823270_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
basex-talk@mailman.uni-konstanz.de