-
Notifications
You must be signed in to change notification settings - Fork 165
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
Don't automatically call attribute setters on mutable objects #3592
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3592 +/- ##
==========================================
+ Coverage 82.29% 84.55% +2.25%
==========================================
Files 648 697 +49
Lines 317517 344997 +27480
==========================================
+ Hits 261305 291697 +30392
+ Misses 56212 53300 -2912
|
There's a failing test https://travis-ci.org/gap-system/gap/jobs/565395421#L2106 |
@wilfwilson The test fails because of #3596 |
52907f5
to
f05ebec
Compare
I've adjusted the test to work around #3596. I think this is now ready. |
doc/ref/types.xml
Outdated
@@ -568,7 +575,8 @@ of the object <A>obj</A> is known. | |||
<Description> | |||
For an attribute <A>attr</A>, <C>Setter(<A>attr</A>)</C> | |||
is called automatically when the attribute value has been | |||
computed for the first time. | |||
computed for an immutable object which does not already have stored | |||
value for <A>attr</A>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a missing article here, I think 'have a value stored' would make it right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks.
f05ebec
to
258df81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer this behaviour, and the changes look correct to me.
Description
This is an alternative to #3588. Instead of stopping the system setters storing in mutable objects, we stop attribute calls from calling the setter altogether in this situation.
This allows for calling the setter directly, but means that even if you have installed a custom setter, it is not called by default.
See also #1371 and #3560
Text for release notes
The values of computed Attributes will no longer be stored automatically in mutable attribute-storing
objects, since they may become out of date as the object mutates. If you wish to store such a value and know that it is safe to do so, then you can address this by calling the corresponding attribute setter directly.