-
Notifications
You must be signed in to change notification settings - Fork 230
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
Scope seems to be considered differently 'on board' and 'in Archive' #3086
Comments
Out of curiosity, does the same error happen if you reverse the order and run it on volume 1 first, then on volume 0 second? The reason for the question: I want to see if the problem is that the two volumes behave differently (which seems unlikely) or if it's just because any time the same program is from two different volumes will it always fail on whichever one is run second? |
I think something really off is going on with scoping when the file is run for the second time from the local volume. Specifically for some reason the local scope that contains the function In an attempt to prove this I changed the test case to be this
and this as the executed file
The most interesting thing about my case is that I don't get the "undefined var" error until the file is run for the second time from the local volume. Also per dunbaratu's question swapping executing from the local volume first as apposed to the archive didn't change the fact the second run throws an error. I also found two workarounds to the issue
Also while not related to your issue this line of code |
Thanks for taking a look to my issues. It's reassuring to know it's not because I made a obvious mistake but because something goes wrong.
LOL. But hey, minifiye worth it since it's able to cut down my code from 60 KB to 18,5 KB, when complier 'only' crunch it to 26 KB ;) (And on board code have been read, re-read, checked, double checked, triple checked, shared, commented, etc ^^ ) |
@Dunbaratu I realize i didn't mention, but all reports nuggreat made are the same in my case :
This report seems to invalidate the title of this issue, but as i dont know how to correctly rename it, I will let it as is until the true source is found ^^. Interessting behavior I think is related : Flight report : I read all files to mix my soup, copy what i need in craft, rewrite a boot file whitch just runOncePath embeded files and call my "main" function, reboot (allow me to bypass the 'second' runoncepath error), launch. |
Sorry if I dont do this correctly, it's my first time (and english is not my native language)
Step to reproduce :
Terminal says at the second runoncepath :
"Undefined Variable Name 'error'."
Without thoses outer braces (witch are legal, if I correctly understand), program don't stop, but i think it reveal a bug witch is a problem in more complex code.
It could be name redondancy, however, as I have coded a minifier who rename variable and function name, before load files in craft, i dont think it's the problem. (in my code, it says "Undefined Variable Name e1", when the source code was a declaration as 'local DeltaVLeft blahblahblah.', so the new name is correctly interpreted -> no name redondancy).
I notice if you don't run from archive before, it work fine.
I assume you would ask yourself why I want to load files AND from archive, AND from craft. It's because, the first run launch procedures witch analyse functions dependencies to load in craft only expected (and minified) files. The second one is to effectively load in the craft all usefull files and function needed to operate in space, out of the scope of any signal from Kerbin (because of remote tech).
Side question, is it possible to «unload» function, or better, all a file scope, as you can unset a variable ? If so, i didn't find how to without 'reboot' (but reboot clear terminal screen, and i don't want this happen).
I hope I did this report fine.
Ask question, if I can help for further information. Love on this team for this wonderfull playground witch is KOS.
The text was updated successfully, but these errors were encountered: