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

Field Read and Write Overloading for Prefereneces #2322

Closed
wants to merge 2 commits into from

Conversation

saturn-volv
Copy link

This adds an abstracted PreferenceMap, which behaves as a StringMap but with some field read and write overloading.

So now instead of needing to call:

Save.instance.options.downscroll = true;

You can accomplish the same thing with:

Preferences.get().downscroll = true;

There are other use cases for this but I'm tired and cannot bring myself to list them all right now

Copy link

@Raltyro Raltyro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sick
Though i think you can instead immediately do return get().value = value;

@saturn-volv
Copy link
Author

return get().value = value;

I initially did but the code style doesn't want inner assignment used.
image

@Raltyro
Copy link

Raltyro commented May 9, 2024

i forgot codestyle exists whoopsm..

@EliteMasterEric EliteMasterEric changed the base branch from main to develop May 17, 2024 23:20
@EliteMasterEric
Copy link
Member

This looks like a great bit of code cleanup!

Also, the codestyle is bugged, it should be allowing inner assignment in return statements.

> Also, the codestyle is bugged, it should be allowing inner assignment in return statements.
- [EliteMasterEric](FunkinCrew#2322 (comment))
@EliteMasterEric EliteMasterEric added status: pending triage The bug or PR has not been reviewed yet. and removed reviewing-internally labels Jun 16, 2024
@EliteMasterEric EliteMasterEric removed their assignment Jun 17, 2024
@EliteMasterEric EliteMasterEric added medium A medium pull request with 100 or fewer changes type: optimization Involves a performance issue or a bug which causes lag. and removed status: pending triage The bug or PR has not been reviewed yet. labels Jul 10, 2024
@EliteMasterEric EliteMasterEric deleted the branch FunkinCrew:develop July 12, 2024 00:59
@EliteMasterEric
Copy link
Member

I just looked into this more and I actually don't think this is much of an improvement over the existing Preferences map.

@EliteMasterEric EliteMasterEric added the status: rejected Issue did not pass review or PR cannot be approved. label Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium A medium pull request with 100 or fewer changes status: rejected Issue did not pass review or PR cannot be approved. type: optimization Involves a performance issue or a bug which causes lag.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants