-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Breaking or Continuing a loop with mixins? #55
Comments
This is pretty much impossible. |
However there are other things which are planned which you could probably leverage to do something like that. |
Why is this impossible? |
Because there's no such thing as a loop or the concept of Okay, "impossible" is probably over-stating somewhat, but "incredibly hard, bordering on impossible" would be closer. |
Wouldn't it be possible to make something like this:
Than this also could be helpfully to overwrite pieces of code in a method. Like you inject and than jump over the code you don't want to use anymore. |
No, injectors already are a little too close to needing to understand bytecode for my liking, but there's no way around it. With rerouters, understanding bytecode is actually required but the code generated is still safe. There is no way I am going to allow the mixin author to control the bytecode, see this old reply, that is not what mixin is about. Mixin isn't just a library for "making ASM hackery easy", that is not what it is about. It is a way of defining deterministic transformations to target classes which can be generated and injected into the target class in such a way that the output bytecode falls in to one of two guarantees:
This is why there are so many checks and balances in Mixin and why any type of hackery is not happening. Rerouters are by the far the hackiest feature, and are not going to be released until I'm satisfied that the LVT inflection upon which they rely is stable to my satisfaction. Even then, their scope is limited such that the code they inject will always be sane. This has always been the case, people get so fixated on doing things with mixins that they forget that you can do whatever you want to with a transformer. But I am not prepared to ever let the end user have any direct control over the bytecode which is injected. Literally the only exception to this currently is the |
I am going to explain it with an example.
Lets say I want a mixin like this:
The text was updated successfully, but these errors were encountered: