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

Factor our the inner Value trait in ModularSchemeLattice #22

Open
noahvanes opened this issue Jan 19, 2021 · 0 comments
Open

Factor our the inner Value trait in ModularSchemeLattice #22

noahvanes opened this issue Jan 19, 2021 · 0 comments
Labels

Comments

@noahvanes
Copy link
Collaborator

ModularSchemeLattice uses a sealed inner trait Value (and inner case classes that extend this trait) to efficiently represent a product lattice of several sublattices. A side-effect of doing so is that all values represented in the analysis are composed of inner case classes that belong to a particular (outer) ModularSchemeLattice instance. This makes it impossible to directly compare values between different analyses if they represent values using different ModularSchemeLattice instances (even if they have the exact same configuration and/or would be considered equal). As a less-than-ideal workaround, maf.modular.scheme.SchemeDomain currently pre-instantiates a few ModularSchemeLattice instances for common configurations, and ensures these are shared between different analyses that use the same configuration. Using inner classes to represent values also poses challenges to proper serialisation/deserialisation (e.g., deserialise(serialise(v)) != v), which is necessary to persist analysis state (cf. #13).

Factoring the trait Value out of ModularSchemeLattice should resolve these issues.
However, doing so naively might introduce difficulties in dealing with all types (and typeclasses) used by the sublattices.
Alternatively, one might want to wait for the arrival of Scala 3's union types, which be might able to replace the inner Value trait inside ModularSchemeLattice easily without the downsides that come from using inner case classes.

@noahvanes noahvanes changed the title Factor our the inner Value trait in ModularSchemeLattice Factor our the inner Value trait in ModularSchemeLattice Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant