-
Notifications
You must be signed in to change notification settings - Fork 414
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
[Compiler] Variable "has no value" when compiled (interpreted works) #5451
Comments
After a short analysis, I am not still not sure if it is a compiler limitation (most probably) or just a bug. The core issue is that I will do a more in-depth investigation in the next days to get to the bottom of it, though, in the meantime, you can use at least two workarounds:
Anyway, I am working on deprecating the high-level compiler partially (or completely), so that all provided Red code will be directed to the interpreter, getting rid of those problematic static/dynamic combos edge cases for the compiler. Such cases can be solved but the increase in complexity in the compiler internals is just not worth the effort. They are better (cleaner, faster, shorter) ways. |
It doesn't make sense to me that switch takes a static block, I expected it to bind to the self by default (which would match interpreted). Your work around #2 does work however #1 doesn't: I'm guessing by "high-level compiler" you mean compiling ahead of time instead of JIT. Being able to do |
After a deeper analysis, I confirm that it is a compiler limitation: the
I should have used "literal" instead of "static" there to avoid misunderstanding.
You're right, I've missed that, sorry.
I meant the Red to Red/System compiler which is currently an AOT one. In the future, we will have a JIT one, which is a much better fit for Red semantics.
We're keeping that of course.
That's exactly right. |
I will leave that ticket open with the "wontfix" status until we drop the Red compiler. Once that done, we'll close all the "type.compiler" tickets all together. |
Describe the bug
Confusing compilation behavior is wrong and inconsistent with interpreted. For some reason the variable "has no value".
To reproduce
Unfortunately the minimum reproducible example is a little large:
When compiling this code with
redc -c
orredc -r
then running it, it will fail with "Script Error: deltaStream has no value" inside the switch even though it can print fine just before that.Additionally
redc -c
will work with any of these (illogical) changes:Expected behavior
Running the interpreter (or compiling with -e) correctly prints "switch deltaStream = 64".
Platform version
The text was updated successfully, but these errors were encountered: