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

Why did you change the standard getters/setters? #29

Open
realcbnewham opened this issue Apr 13, 2024 · 2 comments
Open

Why did you change the standard getters/setters? #29

realcbnewham opened this issue Apr 13, 2024 · 2 comments

Comments

@realcbnewham
Copy link

I'd put this in discussion but there doesn't seem to be one - and it is somewhat of a feature request.

This library is excellent apart from the fact that you have renamed the functions. Why does it have to be "set" and "takeXXX" when it should be using the original put and get names (and set and take are not opposites in English)? This could been a very convenient drop-in but I've spent a lot of time renaming all of the getters/setters from my Android native code in order to use this in a KMP version. It's a real PITA and I do not see why it was necessary.

Please consider using the original MMKV function signatures and names as aliases for your function names.

@9468305
Copy link
Collaborator

9468305 commented Apr 15, 2024

In MMKV original version, different languages have different function signatures.
Java: "encode" and "decode", "getXXX" and "putXXX".
Objective-C: "getXXX" and "setXXX".
It need to be consistent in MMKV-Kotlin, but "takeXXX" is not the best name indeed.

@qiaoyuang
Copy link
Collaborator

Hi, originally, during the development process, when I took the API names same with the MMKV Java version, that's very confusing, and very easy to make mistakes. So, I changed these names. Actually, the takeXxx APIs are just like the APIs in JSONObject. Now, I would consider adding a set of new APIs, make them more common, and easy to understand. Thanks for your issue.

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

No branches or pull requests

3 participants