Skip to content

System.Numerics readonly annotation#51797

Merged
6 commits merged intodotnet:mainfrom
hrrrrustic:issue-1718-Numerics
Apr 29, 2021
Merged

System.Numerics readonly annotation#51797
6 commits merged intodotnet:mainfrom
hrrrrustic:issue-1718-Numerics

Conversation

@hrrrrustic
Copy link
Contributor

This PR is a part of #46675

@ghost
Copy link

ghost commented Apr 24, 2021

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Apr 24, 2021

Tagging subscribers to this area: @tannergooding, @pgovind
See info in area-owners.md if you want to be subscribed.

Issue Details

This PR is a part of #46675

Author: hrrrrustic
Assignees: -
Labels:

area-System.Numerics, new-api-needs-documentation

Milestone: -

@tannergooding
Copy link
Member

The changes to Complex LGTM. I'm comfortable with us saying that the properties, Equals, and ToString methods will never mutate. It's probably even worth refactoring Complex.Sqrt so it can be a readonly struct.

BitIntegerCalculator.BitsBuffer on the other hand is an internal type and so I'm not sure if its worth actually updating it to be readonly.

@hrrrrustic
Copy link
Contributor Author

hrrrrustic commented Apr 25, 2021

@tannergooding Updated Complex (fix Sqrt method and mark whole struct)
Should I revert BitIntegerCalculator.BitsBuffer now or we are waiting somebody else's opinion?

@jkotas
Copy link
Member

jkotas commented Apr 25, 2021

Should I revert BitIntegerCalculator.BitsBuffer now

Yes, I think so.

In general, it is not very valuable to use readonly on types that are designed to be mutable, such as BitsBuffer.

@hrrrrustic
Copy link
Contributor Author

@jkotas Done
Some unrelated errors in CI

@jeffhandley jeffhandley marked this pull request as draft April 29, 2021 20:45
@jeffhandley
Copy link
Member

This PR is being marked as a draft per #46675 (comment).

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

@tannergooding I think this one is good and we can merge it. Do you agree?

@tannergooding
Copy link
Member

I think this one is good and we can merge it. Do you agree?

Yes, just need to do a final review pass over the Sqrt refactoring

@tannergooding tannergooding marked this pull request as ready for review April 29, 2021 21:04
@tannergooding
Copy link
Member

This PR is being marked as a draft per #46675 (comment).

This is one we are wanting to take. Complex is a small numeric struct type where the entire struct should have been readonly.

Like many small numeric types, it is conceptually its own primitive and mutating one of its two instance fields isn't really desirable.

@ghost
Copy link

ghost commented Apr 29, 2021

Hello @tannergooding!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@tannergooding
Copy link
Member

I've requeued the failing job and set auto-merge.

@ghost ghost merged commit 6d02eb2 into dotnet:main Apr 29, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants