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

Make all Integers immutable #47

Open
make-github-pseudonymous-again opened this issue May 4, 2020 · 0 comments
Open

Make all Integers immutable #47

make-github-pseudonymous-again opened this issue May 4, 2020 · 0 comments

Comments

@make-github-pseudonymous-again
Copy link
Owner

  • Add a special flag property to mark an Integer as immutable.
  • Require user to a.clone() every integer that he wants to use later (or a.freeze(), or a.copy(), not so sure about the name) before any instruction on them is called. This sets the immutable flag.
  • Remove all i(n) instructions, instead all remaining instructions can exploit the fact that an operand is not marked as immutable to save on computation time.
  • Exploit class inheritance: have special classes for some small constants with hardcoded instructions. Always mark them as immutable.

This would allow Integers to be used as keys in search trees and tables (by inserting only freezed instances).

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

No branches or pull requests

1 participant