Skip to content

Conversation

@firewave
Copy link
Collaborator

No description provided.

@firewave
Copy link
Collaborator Author

This is in preparation because an upcoming PR will change the lifetime of TokenList which requires me to move it.

Please let's not get into a "you should not have references in objects" discussion. That will be addressed later (I thought our usage was fine but there was a fundamental misunderstanding on my side) - with the help of clang-tidy.

@pfultz2
Copy link
Contributor

pfultz2 commented Apr 12, 2025

If a token has a reference back to the list then maybe it should be a weak_ptr or shared_ptr so we have better tracking of lifetimes.

Also it seems like the TokenList should construct the Token class instead since the lifetime is tied together. Although, I dont really follow what this code does, it seems quite confusing with a lot of pointer chasing going on.

@firewave
Copy link
Collaborator Author

If a token has a reference back to the list then maybe it should be a weak_ptr or shared_ptr so we have better tracking of lifetimes.

Yes - I will look into this when I review the usage of references in class.

Also it seems like the TokenList should construct the Token class instead since the lifetime is tied together. Although, I dont really follow what this code does, it seems quite confusing with a lot of pointer chasing going on.

One of the reasons why I wanted things more explicit and less cyclic/dependent.

@chrchr-github chrchr-github merged commit 1cd7299 into danmar:main Apr 14, 2025
53 checks passed
@firewave firewave deleted the backforthlist branch April 14, 2025 08:37
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.

4 participants