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

Don't automatically call attribute setters on mutable objects #3592

Merged
merged 5 commits into from
Aug 14, 2019

Conversation

stevelinton
Copy link
Contributor

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.

@stevelinton stevelinton added kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) topic: kernel release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Jul 24, 2019
@codecov
Copy link

codecov bot commented Jul 29, 2019

Codecov Report

Merging #3592 into master will increase coverage by 2.25%.
The diff coverage is 83.33%.

@@            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
Impacted Files Coverage Δ
lib/sgpres.gi 76.62% <100%> (+4.02%) ⬆️
lib/tietze.gi 76.34% <100%> (+0.14%) ⬆️
src/opers.c 94.87% <75%> (+3.54%) ⬆️
src/libgap-api.c 64.61% <0%> (-7.3%) ⬇️
src/sysmem.c 58.62% <0%> (-5.52%) ⬇️
src/gasman.c 86.28% <0%> (-5.04%) ⬇️
src/hookintrprtr.c 67.34% <0%> (-3.32%) ⬇️
src/io.c 78.7% <0%> (-2.65%) ⬇️
src/read.c 96.58% <0%> (-2.11%) ⬇️
src/system.c 74.11% <0%> (-2%) ⬇️
... and 340 more

@stevelinton stevelinton removed the do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) label Jul 29, 2019
@stevelinton stevelinton changed the title WIP Don't automatically call attribute setters on mutable objects Don't automatically call attribute setters on mutable objects Jul 29, 2019
@stevelinton
Copy link
Contributor Author

Assuming this round of tests pass, I'm now proposing this for inclusion. It seems the better of the reasonably simple alternatives for fixing #1371 and the issues that arose with #3560.

@coveralls
Copy link

Coverage Status

Coverage increased (+9.0e-05%) to 84.296% when pulling 597045b on stevelinton:mut-attrs2 into 89e7fe2 on gap-system:master.

@wilfwilson
Copy link
Member

There's a failing test https://travis-ci.org/gap-system/gap/jobs/565395421#L2106

@stevelinton
Copy link
Contributor Author

@wilfwilson The test fails because of #3596

@stevelinton
Copy link
Contributor Author

I've adjusted the test to work around #3596. I think this is now ready.

@@ -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>.
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks.

Copy link
Member

@wilfwilson wilfwilson left a 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.

@stevelinton stevelinton merged commit 8b3cb84 into gap-system:master Aug 14, 2019
@DominikBernhardt DominikBernhardt removed the release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes label Aug 20, 2019
@DominikBernhardt DominikBernhardt added the release notes: added PRs introducing changes that have since been mentioned in the release notes label Aug 20, 2019
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.11.0 milestone Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements release notes: added PRs introducing changes that have since been mentioned in the release notes topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants