-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Values are memoised across class/prototype instances #74
Comments
Thanks for trying the new decorator and opening an issue. Are you sure that test runs at all? |
The tests run ok, but I think you're referring to not defining |
// @Richienb |
Should mem be memoizing values returned by a function across instances or for each instance? |
For each instance by default at least. We could consider adding an option to opt into memorization across instances. |
Hi!
On the surface, it's kind of logical that (by default) values are instances are memoised across instances, because they're just function calls.
However: a) that seems almost never like intended behaviour, and b) there's a test that seems like it's explicitly trying to test for this.
Unfortunately, the test is only correct as a side effect. If you pass a new initial value into the constructor, you can break the logic (I've fixed the test on my branch, but not sure how to fix the actual problem!)
Do you know how, either as a library consumer, or within the library itself we could get this working as expected?
The text was updated successfully, but these errors were encountered: