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

Union processing fix proposed #44

Closed
wants to merge 1 commit into from

Conversation

andrik75
Copy link

Currently a union instance saves its data by taking the longest field in the union. Bit it doesn't guarantee it's proper data after some field has been modified there. The fix fixes the issue.

Currently a union instance saves its data by taking the longest field in the union. Bit it doesn't guarantee it's proper data after some field has been modified there. The fix fixes the issue.
@andrik75
Copy link
Author

Currently a union instance saves its data by taking the longest field in the union. But it doesn't guarantee it's proper data after some field has been modified there. The fix fixes the issue.

@Schamper Schamper self-assigned this Aug 18, 2023
@Schamper Schamper self-requested a review August 18, 2023 15:46
@Schamper
Copy link
Member

Schamper commented Aug 24, 2023

Wanted to give a short status update here. I've been trying out my idea of having "proxy" objects only for unions to hopefully not impact performance too much for other structures. I've got it mostly working, just need to figure out a solution for anonymous unions. If that doesn't work out, I'll probably end up making some suggestions to your PR that ends up being somewhere in the middle.

@Schamper
Copy link
Member

Schamper commented Oct 29, 2023

Another small update. I've decided to only work on adding this feature to the upcoming cstruct "v4" (#35). The way how I wanted to incorporate this is a lot easier with the new type model introduced there.

You can view my solution in the linked PR (#49). It would be interesting to learn if all of your use-cases are covered by that branch.

@Schamper
Copy link
Member

Schamper commented Jan 2, 2024

#49 has since been merged into the v4 branch. It won't be long until we merge that into main. I'll close this PR but would like to thank you for the idea and suggestion!

@Schamper Schamper closed this Jan 2, 2024
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.

2 participants