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

Extend obsolete to support multiple levels #2923

Merged
merged 1 commit into from
Oct 25, 2018

Conversation

ChrisJefferson
Copy link
Contributor

One problem with the way we currently handle 'obsolete' is that normal users of GAP will never see an obsolete warning, until we delete the function (as they don't tend to increase InfoObsolete, or run with -O).

This extends 'obsolete' into two levels, 1 and 2. Level 1 messages are always printed, level 2 messages have to be explicitly enabled.

The -O option still disables any obsolete functions from being used at all.

My long-term plan is that we would put obsolete messages in a major release at level 1 before removing them, so users would actually see a warning, and have the chance to fix their code.

If changing how InfoObsolete works upsets anyone, we could add a different variable (InfoObsoleteSoon?) which displayed messages about things we will delete in the future.

@fingolfin
Copy link
Member

See also issue #1456

Copy link
Member

@olexandr-konovalov olexandr-konovalov left a comment

Choose a reason for hiding this comment

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

I like this. Would love to see further PRs which will update DeclareObsoleteSynonym, to be reviewed, and then indeed to see things being removed as intended.

lib/obsolete.gd Outdated Show resolved Hide resolved
lib/obsolete.gd Show resolved Hide resolved
tst/testbugfix/2013-06-14-t00300.tst Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 18, 2018

Codecov Report

Merging #2923 into master will decrease coverage by 8.16%.
The diff coverage is 96%.

@@            Coverage Diff             @@
##           master    #2923      +/-   ##
==========================================
- Coverage    83.8%   75.64%   -8.17%     
==========================================
  Files         681      625      -56     
  Lines      346747   312674   -34073     
==========================================
- Hits       290591   236518   -54073     
- Misses      56156    76156   +20000
Impacted Files Coverage Δ
lib/info.gi 77.03% <100%> (-0.11%) ⬇️
lib/obsolete.gd 93.02% <95.83%> (-0.04%) ⬇️
src/libgap-api.c 0% <0%> (-93.34%) ⬇️
lib/contfrac.gi 6.66% <0%> (-83.34%) ⬇️
lib/proto.gi 2.04% <0%> (-81.64%) ⬇️
lib/ctbllatt.gi 0.88% <0%> (-79.93%) ⬇️
lib/ctblauto.gi 6.15% <0%> (-77.9%) ⬇️
lib/teachm2.g 23.07% <0%> (-76.93%) ⬇️
lib/algliess.gi 0.99% <0%> (-74.51%) ⬇️
lib/ctblpope.gi 1.82% <0%> (-72.35%) ⬇️
... and 376 more

@ChrisJefferson
Copy link
Contributor Author

Hopefully all @fingolfin 's comments addressed, once tests cycle (adding a test did find a bug, where only printing the message once meant the message was never shown if the function had been called when the Info level was too low to show it).

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Glad that adding tests revealed a bug, it once again proves the importance of tests. ;-)

doc/ref/obsolete.xml Outdated Show resolved Hide resolved
lib/obsolete.gd Outdated Show resolved Hide resolved
lib/obsolete.gd Outdated Show resolved Hide resolved
lib/obsolete.gd Outdated Show resolved Hide resolved
@fingolfin
Copy link
Member

The manual tests fail.

Obsolete warnings of level 1 will be displayed by default.
Obsolete declarations taken an optional argument to set obsolete
level (which defaults to 2).
Obsolete warnings are now only printed once per obsolete function.
@fingolfin fingolfin merged commit 1ba602d into gap-system:master Oct 25, 2018
@olexandr-konovalov olexandr-konovalov added the release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes label Oct 25, 2018
@ChrisJefferson ChrisJefferson deleted the obsolete branch January 20, 2019 13:38
@DominikBernhardt DominikBernhardt added release notes: added PRs introducing changes that have since been mentioned in the release notes and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Aug 22, 2019
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.11.0 milestone Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: added PRs introducing changes that have since been mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants