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

Clean and reorganize OffsetString and StringPool #1137

Merged
merged 6 commits into from
Jan 8, 2024
Merged

Conversation

Hind-M
Copy link
Collaborator

@Hind-M Hind-M commented Dec 7, 2023

  • Move definitions to cpp files
  • Remove unnecessary headers inclusions
  • Remove OffsetString::offset_t and StringPool::offset_t in favor of entity::position_t (same thing, different names). This will avoid including offset_string.hpp and string_pool.hpp just for these while types.hpp is already there
  • Define types in a specific file to be included where needed instead of the whole types.hpp (to be done in an upcoming PR)

@Hind-M Hind-M force-pushed the clean_string branch 3 times, most recently from fb5c429 to 8806c25 Compare December 8, 2023 15:11
@Hind-M Hind-M force-pushed the clean_string branch 2 times, most recently from fb83a62 to a9818a5 Compare December 21, 2023 16:53
@Hind-M Hind-M marked this pull request as ready for review December 22, 2023 09:25
Copy link
Collaborator

@alexowens90 alexowens90 left a comment

Choose a reason for hiding this comment

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

The hpp->cpp changes all look good. What is the motivation for changing StringPool::offset_t and OffsetString::offset_t to entity::position_t everywhere?

@Hind-M
Copy link
Collaborator Author

Hind-M commented Jan 2, 2024

The hpp->cpp changes all look good. What is the motivation for changing StringPool::offset_t and OffsetString::offset_t to entity::position_t everywhere?

To simplify, and because using StringPool::offset_t and OffsetString::offset_t involves including the corresponding headers offset_string.hpp and string_pool.hpp while types.hpp is already included (which contains entity::position_t which is the same thing as X::offset_t).
A good next step would be to move the position_t-like types from types.hpp to a separate file to be included instead of shipping the whole types.hpp.

@alexowens90
Copy link
Collaborator

The hpp->cpp changes all look good. What is the motivation for changing StringPool::offset_t and OffsetString::offset_t to entity::position_t everywhere?

To simplify, and because using StringPool::offset_t and OffsetString::offset_t involves including the corresponding headers offset_string.hpp and string_pool.hpp while types.hpp is already included (which contains entity::position_t which is the same thing as X::offset_t). A good next step would be to move the position_t-like types from types.hpp to a separate file to be included instead of shipping the whole types.hpp.

There might be a reason the separate types were originally created, maybe @willdealtry can weigh in?

@willdealtry
Copy link
Collaborator

The hpp->cpp changes all look good. What is the motivation for changing StringPool::offset_t and OffsetString::offset_t to entity::position_t everywhere?

To simplify, and because using StringPool::offset_t and OffsetString::offset_t involves including the corresponding headers offset_string.hpp and string_pool.hpp while types.hpp is already included (which contains entity::position_t which is the same thing as X::offset_t). A good next step would be to move the position_t-like types from types.hpp to a separate file to be included instead of shipping the whole types.hpp.

There might be a reason the separate types were originally created, maybe @willdealtry can weigh in?

I don't think it hugely matters. I wrote the string pool in the first or second week, it's possible that position_t didn't exist at that point. The purpose is similar enough (it's an offset in the buffer) that I think we can just use one.

@Hind-M Hind-M merged commit 06a252f into master Jan 8, 2024
130 checks passed
@Hind-M Hind-M deleted the clean_string branch January 8, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants