Skip to content

Address Entities::len inconsistency #18190

Merged
alice-i-cecile merged 5 commits intobevyengine:mainfrom
ElliottjPierce:address-`Entities-len`-inconsistancy-
Mar 10, 2025
Merged

Address Entities::len inconsistency #18190
alice-i-cecile merged 5 commits intobevyengine:mainfrom
ElliottjPierce:address-`Entities-len`-inconsistancy-

Conversation

@ElliottjPierce
Copy link
Copy Markdown
Contributor

Objective

I was recently exploreing Entities and stumbled on something strange. Entities::len (the field) has the comment Stores the number of free entities for [len](Entities::len), refering to the method. But that method says The count of currently allocated entities. Looking at the code, the field's comment is wrong, and the public len() is correct. Phew!

Solution

So, I was just going to fix the comment, so it didn't confuse anyone else, but as it turns out, we can just remove the field entirely. As a bonus, this saves some book keeping work too. We can just calculate it on the fly.

Also, add additional length methods and documentation for completeness. These new length methods might be useful debug tools in the future.

@ElliottjPierce ElliottjPierce changed the title Address entities len inconsistency Address Entities::len inconsistency Mar 7, 2025
@alice-i-cecile alice-i-cecile added C-Docs An addition or correction to our documentation A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Mar 7, 2025
@chescock chescock 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 Mar 7, 2025
ElliottjPierce and others added 2 commits March 7, 2025 12:29
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Mar 10, 2025
Merged via the queue into bevyengine:main with commit 65a9e6f Mar 10, 2025
31 checks passed
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-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants