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

Dictionaries for tuple data values #553

Merged
merged 19 commits into from
Dec 3, 2024
Merged

Dictionaries for tuple data values #553

merged 19 commits into from
Dec 3, 2024

Conversation

mkroetzsch
Copy link
Member

This branch introduces support for labelled and unlabelled tuple data values to be used in the dictionary.

@mkroetzsch mkroetzsch marked this pull request as ready for review December 2, 2024 13:41
@mkroetzsch
Copy link
Member Author

Some explanation for potential reviewers

This branch introduces a new form of dispatch to accomplish code separation in child dictionaries in a situation where a child dictionary would need to know (and call) its parent, which rust does not allow to happen due to borrowing rules. The solution is to replace methods of the child dictionary by global functions (provided by the child dictionary) that receive only the parent dictionary and an id that allows the original child dictionary to be retrieved when needed. Some more magic with Any is used to cast these child dictionaries into the types that are required. The default setup for this can be seen in the "with parent" default implementations in datavalue_dictionary.rs, which merely call the child dictionary's methods there.

The net effect of this stunt is that we can keep tuple serialisation/deserialisation code in the TupleDvDictionary although this code requires access to the parent dictionary to encode/decode values inside the tuple.

@mkroetzsch mkroetzsch linked an issue Dec 3, 2024 that may be closed by this pull request
Copy link
Collaborator

@matzemathics matzemathics left a comment

Choose a reason for hiding this comment

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

I think this looks good for now. Not sure how to efficiently solve the tuple_bytes vs tuple_bytes_mut issue, or if there even is a good solution currently.

@mkroetzsch mkroetzsch merged commit 379844d into main Dec 3, 2024
8 checks passed
@mkroetzsch mkroetzsch deleted the funcdict branch December 3, 2024 18:29
@mkroetzsch
Copy link
Member Author

Thanks for the helpful comments. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Support tuples (including function terms) in dictionary
3 participants