-
Notifications
You must be signed in to change notification settings - Fork 333
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
Tracking issue for old broken E2s: BFW / ALXPC #2841
Comments
BFW
|
New change to function ensures they return something at compile time for performance. This function was missing a return in case all the if statements failed wiremod/wire#2841
Testing on the latest version of wiremod, this is causing some of my old public E2s to stop working. Narrowed it down to a setup like this: @name bruh
@strict
if(first()) {
timer("piss", 0)
Var = 0
}
if(clk("piss")) {
Var++
print($Var)
timer("piss", 1000)
} I would expect it to be printing 1 every second, instead it just seems to be printing the current value of Var. |
|
Sorry, edited, check now |
Hi, the recent E2 update changed Delta in such a way that it no longer provides damping to my hovering vehicles, resulting in bouncing and crashing into every type of terrain it encounters. An example being:
Where Vel_Delta is supposed to measure Vel's difference between the previous and current interval, or change in distance from the ground in case of a ranger, and gets fed into applyForce. Currently, $ doesn't do anything at all, as if the person forgot to put the required value in @persist. |
Probably from @Denneisk's EGP rewrites, would be worth trying to reproduce to him.
The message says they will be an error on Lambdas are the same though. They are function references. At the moment there's no functionality to reference builtin functions, but that isn't hard to implement, at least for freestanding functions. Methods would be annoying indeed so I guess I would have to essentially reimplement stringcalls with Once again reiterating they aren't being removed. This is just a warning to let people know in advance that there is a significantly better system now they can start migrating to.
Many programming languages like? Only programming language that I know has string calls is PHP. And everyone knows PHP is hot garbage. Also FYI, PHP is also replacing string calls with a delegate / lambda system, exactly like what I'm doing with E2. Even if a bunch of languages had string calls they are just really bad. Delegate system / lambdas are much better.
You are indeed wrong, the entire point of a lambda is that they can be replaced at runtime.. let X = function() {}
X = function() {} Better yet, E2's lambdas, not dissimilar to tables, are type erased at compile time. So you could even replace a function that takes a number with one that takes a string. |
It might be related to parent system or something. Previously if we set parent then coordinates are going from parent not global ones, or something like this. but now it goes totally off. Need to write some example then later... because no sense to push update if egp is broken
well, by your example it means i need replace it WITH function, while callable string only have name of function. so for example if i need call some function when receive it as string argument - it will be tons of IF rules then with lambda variables instead of just FuncNameVar(), or at least i don't see how i can call needed function. here is few examples:
with lambda it will need to pass func reference, but if its cross-chip communication (like i have dsSendDirect), you don't have that function in CPU for example, but have only on GPU side, or etc. So i can't pass func reference in this case and on other chip will be then something like this:
Except there will be way to get func reference from string. like this
|
This could be part of the fix for parented objects not being drawn to the top left after being parented. If your code is manually correcting for
You can have a table of functions by name so you can do const Functions = table(
"someTestFunc" = SomeTestFunc,
"someOtherTestFunc" = SomeOtherTestFunc
) And then use that when trying to "string call". |
now each new function needs to be added to table, and then having huge table with 100+ functions in list. but yeah thats possible, but can't be made as simple as it is with callable string. anyway will back to egp when will have example, do i need open new issue for that? |
I don't intend on reverting EGP parenting since it was bad design before. If you want to keep it the old way you'll have to disable Line 201 of alx_pc/gpu/alxos/installos.txt Spos = vec2(Size[1]/2*(-1)+10,Size[2]/2*(-1)) This line for example can be simplified to just Spos = vec2(10, 0) |
why its bad design? relative to parent is as simple as css position: relative / absolute; or i'm already forgot something. i'll check your example later. i just wanted to know what exactly changed in recent updates. thanks |
The function name implies that everything should draw from the top left corner based on the parent's top left corner. When objects are parented, the old functionality was that parented objects wouldn't draw from the top left. This was changed so that they do. It's still a bit misleading in that stuff like circles and polys don't offset based on their size but I was worried that would cause too much confusion. I could try to see about making something for relative position on parented objects.
These are all (or most) of the functionality-changing EGP PRs that I've made |
Oh damn, i have much more issues, when trying to create file there is some error in e2 and hdd controller crashes:
Guess some function doing this... and i guess there will be tons of this. Basically i guess can RIP whole project now, since that will take forever to fix all issues. |
I can lift the restriction if you're referring to lambdas. Denneisk already brought this up to me but I was against it |
After some checks, it seems like i have call function what return number but i'm calling it as void, basically like that:
And this causes this error. before i could call any func regardless if it return or not (more flexible way) so i assume those func return check should be really applied for strict mode maybe... |
@Denneisk i found one more issue with EGP and egpRemove func. By some reason position shift if re-use index and parent second time after calling egpRemove. Here is example script (partial cut from my code):
If run in without "clearLines" it looks as this: but if uncomment it - this will happend: Did for a while to find reason of menus shifting after redraw. This doesn't happens earlier. Also this happens if open menus and close them, after some attempts this start happening due to same bug i guess: |
Thanks for the report. |
so you propose to remove my addon from workshop then? my project way huge to fix and recode tons of stuff because of this "it doesn't seem like a regression. Just a slightly stricter standard" ? This change breaks some behavior when i could return only when needed and use different set of functions... now its required to not just return, but also change code with mandatory making it as expected value and not just call without needed for store output in other variable. |
@AlexALX I don't know without seeing what code of yours is broken |
Here is super simple example
sv: Expression 2 (generic): Runtime error 'Mismatching return types. Got n, expected void' at line 11, char 1 Now it must be:
to work without error, which makes need to know return type of function if you even don't need anything in return from this scenario.. when you have tons of functions like that it makes issues to update all places. if its not strict mode, why limit to this.. |
To more clarify why i need this - i have special "cmdRun" function, which can call anything, it could be function WITH return, or WITHOUT return. this feature now completely broken and not possible to call functions in this way. which broke rest of stuff i have. my propose remove this error check if chip running non in strict mode. that should solve my issues. In other case i really can't fix this and can rip my project, because don't have way to implement this in dynamic way. (no way to call function without knowing its return type) |
Can you give an example of generic typing you're trying to accomplish? I've yet to see a simple example that actually proves there's an issue. The example above is way too simple and doesn't highlight the issue. I.e. show us why |
Going to ping @Vurv78 too since he knows more about it than I. |
Ok lets try next scenario:
so 2 option is broken after this changes. to fix that i need to write wrapper functions which will return void for any function which needs to be used. something like that probably...
which makes more code and looks ugly. but yeah, probably can be "fixed" in this way... only one issue is make this for every function what could be used in such behavior... |
You're still not showing why you need it to be |
"test" will be in variable, which will be in another place. then wrapper which can run any function without knowing its return type and don't need return in response. Its hard to explain why i need this, but all my project is based on callable strings and working with functions in DYNAMIC way In which revision this was added? guess only one option left for me just give link to wire at github with those rev with instruction how install wire from github and not workshop version. |
Why not make all the functions it's capable of accessing have the same return type? |
I guess that's the solution you're trying to avoid. I don't remember when the compiler update was done. Sometime last year. |
yes i also possible, but then in way like "function_name_return_number" and wrap as in example above but with different name, and then update all places which used it. as i said i can use function with hardcoded return AND in some places without need to return anything (so 2 usages for different purposes). and issue maybe not about design of it, but fact that in earlier versions of wiremod it did WORK without needing anything like that! then you made incompatible changes and now need to review tons of code and fix stuff what did WORK before without issues. Why not call then expression v3 or something? to not make incompatible changes. besides this change, also egp change broke all menus etc, which also need update ALL code i have. So for me really easier to write instructions how install older wiremod than try to fix my addon and spend WEEKS on that. |
string function calls had to do type checking at runtime before which would crash the chip if type mismatching was detected. Now those issues are prevented at compile time which improves performance as well. |
The tradeoff is you can't have a generic string call that can call any function type |
Ok, i just did put link to older wiremod version, and said that my addon cannot work with newer version of wire from workshop. Thats all what i can do it seems. Having no time to review & update code. Thanks anyone who tried to help. |
I don't see a problem with allowing this for statements, actually. Checking the code, I think it was an oversight, at least for string calls, that this doesn't work.
The other cases for variadic functions and builtins do allow not specifying the return, But it's not checked here:
Someone can pr to fix that, pretty simple fix. I only had a problem with this for lambdas, where it would incur a perf hit to allow that (but re-thinking, you could just duplicate the code with |
Just do it real quick dude. A quick unit test would be good too. |
This is just an issue to track any progress on fixing E2s unintentionally broken by changes to E2
Largest chip seems to be this BFW, and apparently the ALX E2 PC is also broken.
Currently identified inconsistencies:
wire_expression2_delta
slightly broke one public chip (one leg sticks up), hoping this is rare enough. That code really never should've worked in the first place. But if more chips are found that rely on this behavior, just==
will be reverted to old behavior.The text was updated successfully, but these errors were encountered: