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

Refactoring: Handle Term interning implementation in a single place #343

Open
madmike200590 opened this issue Aug 24, 2022 · 0 comments
Open
Labels
code quality Refactorings and other code-quality-related tasks enhancement good first issue

Comments

@madmike200590
Copy link
Collaborator

Currently, all Term implementations have their own private static Interner which provides a per-class instance cache. By interning, we ensure that for all terms t1 and t2, it holds that t1.equals(t2) iff t1 == t2, i.e. we save memory by avoiding multiple equivalent instances.
Since this is a rather essential feature in order to keep Alpha's memory footprint manageable, it should be ensured that every implementation of Term follows this pattern. It would therefore make sense to have interning handled in a central place (constructor of AbstractTerm?) rather than copy the same code in every Term implementation. (Note: Maybe we could also do something "fancy" like aspect-oriented intercepts of constructor calls, etc.)

@madmike200590 madmike200590 added enhancement good first issue code quality Refactorings and other code-quality-related tasks labels Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Refactorings and other code-quality-related tasks enhancement good first issue
Projects
None yet
Development

No branches or pull requests

1 participant