-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - #4231: panic when App::run() is called from Plugin::build() #4241
Conversation
cbb3fcc
to
a35b026
Compare
If this is wanted, it should be done for Buuuut... I don't think this is wanted. Why would we block a plugin from calling run? Should a |
Maybe not but in my opinion it's probably something we want users to do. It hides the I just find it to be a potential footgun. But that's just how I feel about it haha |
While I agree that panic is extreme, I believe allowing #1255 refers to order independence for plugins, which comfort this stance. That said, I'm ok with displaying that as a warning if it's judged too extreme. Also, if we have real use cases to call |
Plugins should use |
I agree quite strongly with @bjorn3 here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nit, then this LGTM.
I still really don't like this change, but if this gets to be merged could you add a panic section to the doc comment of the |
Agreed; I'm going to block on that suggestion. |
38435ae
to
971bdbe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not in love with this pattern, but I see it largely as an indicator that we should consider a more structured / limited plugin api.
I'm ok with adopting this in the interest of preventing a pattern that we will likely disallow (statically / structurally) in the future.
If conflicts are resolved I'm down to merge this.
@Vrixyz feel free to rebase yourself and I'll remove the Adopt-Me label :) But we took ages on this so I want to make sure you don't feel obliged to. |
971bdbe
to
fe8abaa
Compare
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
fe8abaa
to
aa4d904
Compare
The rebase was not so straightforward, I ended up in setting I have a small doubt about dynamically loaded plugins which would not trigger the |
Yep I'm totally fine with this not working for dynamic plugins. |
bors r+ |
…bevyengine#4241) # Objective Fixes bevyengine#4231. ## Solution This PR implements the solution suggested by @bjorn3 : Use an internal property within `App` to detect `App::run()` calls from `Plugin::build()`. --- ## Changelog - panic when App::run() is called from Plugin::build()
…bevyengine#4241) # Objective Fixes bevyengine#4231. ## Solution This PR implements the solution suggested by @bjorn3 : Use an internal property within `App` to detect `App::run()` calls from `Plugin::build()`. --- ## Changelog - panic when App::run() is called from Plugin::build()
Objective
Fixes #4231.
Solution
This PR implements the solution suggested by @bjorn3 : Use an internal property within
App
to detectApp::run()
calls fromPlugin::build()
.Changelog