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

System.Xml readonly annotation #51798

Closed
wants to merge 3 commits into from
Closed

Conversation

hrrrrustic
Copy link
Contributor

This PR is a part of #46675

@dotnet-issue-labeler
Copy link

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: @buyaa-n, @krwq
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.Xml, new-api-needs-documentation

Milestone: -

Copy link
Member

@krwq krwq left a comment

Choose a reason for hiding this comment

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

The annotations looks good to me.

@krwq
Copy link
Member

krwq commented Apr 27, 2021

Annotations look good to me but I'm not sure that's always a good idea to mark as much as possible as read-only:

  • Can caching be added later? I.e. in some scenarios hash code could be cached but caching would modify the state and therefore make it non-readonly and potentially be a breaking change...
  • Are we introducing "const correctness" in C#? That's probably one of my most hated features in C++ - I'm not personally in favor of having this in C# - it just makes writing code a pain with small benefit - although this is debatable like "tabs" vs "spaces"

@krwq
Copy link
Member

krwq commented Apr 28, 2021

@hrrrrustic we have some offline conversation about this and other similar PRs and we need to figure out the guidelines before we can accept these PRs:

  • it would be a breaking change if we try to remove the read-only in the future so this one way and we need to be really careful what we do here
  • as mentioned above - caching cannot be added after you mark something read-only
  • methods modifying argument but not its own state - they need further thought

likely only subset of the changes can be accepted but we need to figure out what subset exactly. We do agree there is a value in some of those, i.e. marking some structs as read-only but we are not particularly sure about marking methods in general. We will keep you updated.

@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).

@ghost ghost closed this May 29, 2021
@ghost
Copy link

ghost commented May 29, 2021

Draft Pull Request was automatically closed for inactivity. Please let us know if you'd like to reopen it.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 28, 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.

3 participants