Skip to content
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

Revert "Have EntityCommands methods consume self for easier chaining" #15523

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tim-blackbird
Copy link
Contributor

@tim-blackbird tim-blackbird commented Sep 29, 2024

As discussed in #15521

The migration guide of #14897 should be removed
Closes #15521

@@ -1405,8 +1407,8 @@ impl EntityCommands<'_> {
/// # bevy_ecs::system::assert_is_system(remove_character_system);
/// ```
#[track_caller]
pub fn despawn(self) -> Self {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#14897 mistakenly made despawn return self

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context, this wasn't a mistake, it was something acknowledged in the PR: #14897 (comment)

.with_scale(Vec3::new(1.0, 1.0, 0.5)),
..default()
.insert_if(CameraTracked, || i == 0)
.with_children(|parent| {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only indentation/whitespace changes below this comment in this file :)

gits diffs do a surprisingly bad job with indentation changes

@MrGVSV
Copy link
Member

MrGVSV commented Sep 29, 2024

Could you provide details as to why this revert should be merged in your PR description?

@MrGVSV MrGVSV added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Straightforward Simple bug fixes and API improvements, docs, test and examples X-Contentious There are nontrivial implications that should be thought through labels Sep 29, 2024
Comment on lines -393 to +395
self.spawn_empty().insert(bundle)
let mut entity = self.spawn_empty();
entity.insert(bundle);
entity
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the only clear win for consuming self, but that's because the spawn methods return EntityCommands by value either way

@tim-blackbird
Copy link
Contributor Author

Could you provide details as to why this revert should be merged in your PR description?

Apologies, I forgot to link to the relevant issue. Added to the PR description.

@tim-blackbird tim-blackbird added X-Blessed Has a large architectural impact or tradeoffs, but the design has been endorsed by decision makers and removed X-Contentious There are nontrivial implications that should be thought through labels Sep 29, 2024
@Luminoth
Copy link
Contributor

I'm hoping the issue in question gets a little more time to discuss before this goes through.

@alice-i-cecile
Copy link
Member

Yep, I intend to leave this discussion open in the linked issue until the release candidate is due to be cut. Given the level of controversy and breakage, I don't think it should have been merged without more discussion, so the default stance here is "revert".

@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Sep 29, 2024
Copy link
Contributor

@chescock chescock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I compared the diff to the one from #14897, and this does revert the &mut self to self changes while preserving the insert_if changes. (The changes to EntityEntryCommands aren't exactly a revert, but seem to be in the same spirit.)

crates/bevy_ecs/src/system/commands/mod.rs Outdated Show resolved Hide resolved
pub fn and_modify(mut self, modify: impl FnOnce(Mut<T>) + Send + Sync + 'static) -> Self {
self.entity_commands = self
.entity_commands
pub fn and_modify(&mut self, modify: impl FnOnce(Mut<T>) + Send + Sync + 'static) -> &mut Self {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense, but I want to highlight that the changes to EntityEntryCommands aren't exactly a revert. This type didn't exist at the time of the original change, and it could make sense for it to work differently from EntityCommands.

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 2, 2024
@alice-i-cecile
Copy link
Member

@tim-blackbird I'll merge this once you resolve the merge conflicts :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Blessed Has a large architectural impact or tradeoffs, but the design has been endorsed by decision makers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider reverting change to EntityCommands calling convention
5 participants