Skip to content

Conversation

HugoPeters1024
Copy link
Contributor

@HugoPeters1024 HugoPeters1024 commented Aug 26, 2025

Objective

Solution

  • Always parse the child expression within parenthesis to prevent spawning many single component children by accident.

Testing

  • There are no behavioral changes

Open questions

  • When violating this new requirement you get a pretty unhelpful error message. It was suggested in ecs-dev that a better error requires a proc-macro. I didn't feel like I should go ahead with that before gathering some more input from other contributors.

@@ -665,14 +665,14 @@ mod linear_gradient {
angle: LinearGradient::TO_RIGHT,
stops: stops.clone(),
}),
children![
children![(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like this was probably intended to be spawned as a single bundle, as having separate entities with just a Text and a TextFont respectively seems nonsensical.

If so, then I believe this highlights the value of this PR ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the CI confirms this https://pixel-eagle.com/project/b04f67c0-c054-4a6f-92ec-f599fec2fd1d/run/22845/compare/22830?screenshot=testbed_ui/screenshot-LinearGradient.png (what an amazing setup BTW!). I feel like we probably want to use different font settings as this makes the output less readable.

Copy link
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-20760

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

1 similar comment
Copy link
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-20760

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

Copy link
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-20760

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

1 similar comment
Copy link
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-20760

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide X-Controversial There is active debate or serious implications around merging this PR S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 26, 2025
Copy link
Contributor

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

@alice-i-cecile
Copy link
Member

I'm not sure if a better error message requires a proc macro, but I feel strongly that we shouldn't do this without very good, clear error messages.

With one, I'm weakly in favor of this :)

TextSpan::new("IME Active: "),
TextSpan::new("false\n"),
TextSpan::new("IME Buffer: "),
(TextSpan::new("Click to toggle IME. Press return to start a new line.\n\n",)),
Copy link
Member

Choose a reason for hiding this comment

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

This choice introduces significant syntactic noise. I personally still think the "parentheses are optional" rule is preferable.

The the intuitive read of this list is correct:

children! [
  A,
  B,
  C,
]

Rust trains us to read this as "this is a list of the children A, B, and C".

The grammar is "this is a list of children: if you want a child to have more than one component, add parenthesis". That is not so hard to learn that it justifies the added labor of changing it to "this is a list of children, each child must have parenthesis".

Copy link
Member

Choose a reason for hiding this comment

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

Wherever this lands, the resulting choice needs to be in sync with BSN

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mm, I really understand where you're coming from, and if I didn't experience this confusion myself a couple times, I would probably agree with you.

I think the confusion comes from the fact that conceptually bundles are also lists. Given that lists of lists of components are not a common pattern anywhere else, it's super easy to miss the extra nesting. This in itself would again not be so bad if the resulting bugs are usually not immediately obvious and quite difficult to diagnose.

Not to sound too melodramatic, but I fear that a novice making this mistake by accident could be inclined to write Bevy off as unrealible. It really doesnt take long for a new user to run into the children macro, especially when doing ui related stuff.

Finally, I was also never a huge fan of the parenthesis solution, would you maybe have something else in mind?

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 M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Usability: children! macro is easy to subtly hold wrong
3 participants