Skip to content

Arrangement GATs #438

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

Merged
merged 4 commits into from
Dec 4, 2023
Merged

Conversation

frankmcsherry
Copy link
Member

@frankmcsherry frankmcsherry commented Nov 29, 2023

This PR introduces support for Generic Associated Types for arrangement Key and Val associated types. The types are generic in a lifetime 'storage that corresponds to the shared read-only storage from which they are read. Conventionally these types would be &'a Key and &'a Val for some standard key and value types, like String. By allowing them to vary with lifetimes, we can introduce new types that serve a smart pointers to the corresponding content. This allows for example encoded data returned with a shared codebook, or returning pairs of references rather than a reference to a pair (allowing more columnar support).

The changes are pervasive, but everywhere the theme is that ::Key turns to ::Key<'a> and ::Val turns to ::Val<'a>. More traits also now have an associated KeyOwned and ValOwned type; these are lifetime-less types that each of the lifetimed traits can be converted into. There is a helpful trait MyTrait (better name pending) which describes something like a generalization of ToOwned, without requiring a Borrow implementation, and some convenience methods.

The only "harm" I've found so far is that lifetime GATs can force some 'static bound introductions where they didn't exist before. These are e.g. when you write type Val<'a> = &'a T, then T will need to be outlive all of the Val<'a> up to and including Val<'static>.

@frankmcsherry frankmcsherry changed the title DNM: Experimentation with GATS DNM: Experimentation with GATs Nov 29, 2023
@frankmcsherry frankmcsherry force-pushed the egats branch 5 times, most recently from 2aa42f3 to d450719 Compare November 30, 2023 00:12
@frankmcsherry frankmcsherry changed the title DNM: Experimentation with GATs Arrangement GATs Dec 3, 2023
@frankmcsherry frankmcsherry merged commit 5bde556 into TimelyDataflow:master Dec 4, 2023
This was referenced Oct 29, 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.

1 participant