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

cleanup: const a few tox pointers for groupchat API #2379

Closed
wants to merge 1 commit into from

Conversation

JFreegman
Copy link
Member

@JFreegman JFreegman commented Apr 1, 2023

This change is Reviewable

@JFreegman JFreegman added the cleanup Internal code cleanup, possibly affecting semantics, e.g. deleting a deprecated feature. label Apr 1, 2023
@JFreegman JFreegman added this to the v0.2.19 milestone Apr 1, 2023
@codecov
Copy link

codecov bot commented Apr 1, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (a1e2458) 9.98% compared to head (576fcfc) 9.99%.
Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #2379      +/-   ##
=========================================
+ Coverage    9.98%   9.99%   +0.01%     
=========================================
  Files         141     141              
  Lines       32530   32530              
=========================================
+ Hits         3247    3251       +4     
+ Misses      29283   29279       -4     
Files Coverage Δ
toxcore/tox.c 7.80% <0.00%> (ø)

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JFreegman JFreegman added the api break Change breaks API or ABI label Apr 1, 2023
Copy link
Member

@Green-Sky Green-Sky left a comment

Choose a reason for hiding this comment

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

:lgtm_strong:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: 0 of 1 approvals obtained

Copy link
Member

@iphydf iphydf left a comment

Choose a reason for hiding this comment

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

LGTM. There's no API break because there's no release with this API in it, right?

Copy link
Member

@iphydf iphydf left a comment

Choose a reason for hiding this comment

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

@robinlinden pointed out, correctly, that we tend to use const in the public API to mean deep-immutable. What do you think? Should all Tox parameters be const everywhere?

@JFreegman
Copy link
Member Author

JFreegman commented Aug 17, 2023

There's no API break because there's no release with this API in it, right?

Correct (unless you count client releases)

@robinlinden pointed out, correctly, that we tend to use const in the public API to mean deep-immutable. What do you think? Should all Tox parameters be const everywhere?

Is there ever a valid reason for it not to be const?

@iphydf
Copy link
Member

iphydf commented Aug 24, 2023

If we only make the tox functions const that don't modify things inside the tox state, then it helps client code ensure that if they pass a const Tox* anywhere, then no mutations on internal state will happen.

@iphydf
Copy link
Member

iphydf commented Nov 12, 2023

@JFreegman I think the documentation aspect of "const means no changes happen to the object" in a broad sense is useful in the public API. Maybe someday I'll write a linter to enforce something like that, but I'm not sure what the syntax and semantics of that should be.

@iphydf iphydf modified the milestones: v0.2.19, v0.2.20 Nov 12, 2023
@iphydf
Copy link
Member

iphydf commented Jan 10, 2024

Closing this for now. Reopen if you want to discuss reasoning for what "const" should express in the public API.

@iphydf iphydf closed this Jan 10, 2024
@iphydf iphydf modified the milestones: v0.2.20, v0.2.19 Jan 10, 2024
@JFreegman JFreegman deleted the group_const_tox branch January 10, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api break Change breaks API or ABI cleanup Internal code cleanup, possibly affecting semantics, e.g. deleting a deprecated feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants