Open
Description
- Add a special flag property to mark an Integer as immutable.
- Require user to
a.clone()
every integer that he wants to use later (ora.freeze()
, ora.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).