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

[DRAFT FOR CARPET] Reuse immutable instances, make some functions reuse existing code, and some minor changes #198

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

altrisi
Copy link
Owner

@altrisi altrisi commented Oct 23, 2021

All minor changes:

  • Makes NumericValue, StringValue and subclasses return themselves on clone. At the end of the day, all they did was make an instance with the same thing inside. I just thought why have those duped instances. This also changes NullValue.equals() to be reference equality
  • Makes some code (around ValueConversions) reuse existing methods
    • of(Identifier) now uses simplify()
    • Moves some duped code to call ValueConversions
    • Makes of(BlockPos) and of(Vec3d) call ListValue.fromTriple
    • Makes ListValue.fromTriple(int) accept longs instead and use long-specific NumericValue constructor
  • Makes slot id to lv map be int specific
  • Makes constants map static so each expression doesn't hold a copy
  • Makes Value.NULL, Value.TRUE, etc constants final

@altrisi

This comment was marked as outdated.

@altrisi
Copy link
Owner Author

altrisi commented Nov 27, 2021

Pretty much doesn't work, because scarpet relies in specific values for assigning variables...

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