Address Entities::len inconsistency #18190
Merged
alice-i-cecile merged 5 commits intobevyengine:mainfrom Mar 10, 2025
Merged
Conversation
entities len inconsistency Entities::len inconsistency
andriyDev
approved these changes
Mar 7, 2025
chescock
approved these changes
Mar 7, 2025
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
I was recently exploreing
Entitiesand stumbled on something strange.Entities::len(the field) has the commentStores the number of free entities for [len](Entities::len), refering to the method. But that method saysThe count of currently allocated entities.Looking at the code, the field's comment is wrong, and the publiclen()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.