-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add IReadOnlySet<T> interface #32488
Conversation
0e5ce15
to
91bfff5
Compare
@stephentoub Sorry about the naming/rebasing, I dropped when I should've squashed and got myself into trouble. The dangers of not drinking coffee early in the morning |
src/libraries/System.Collections/src/System/Collections/Generic/HashSet.cs
Outdated
Show resolved
Hide resolved
513ff7c
to
c722bdb
Compare
@danmosemsft / @jkotas It's not mentioned in the issue, but should we have |
Note regarding the 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. |
@maryamariyan So I should add to the dev remarks? Even if I haven't actually added a method to the ref/impl |
@eiriktsarpalis @layomia You are the area-System.Collections owners according to https://github.com/dotnet/runtime/blob/master/docs/area-owners.md. Could you please provide guidance to @Jlalond with this PR? |
@Jlalond You are adding the interface only in the src file. Shouldn't new interfaces be added to ref files as well so they can be exposed publicly? Yes, please add triple slash comments on top of the interface's type and methods. We have new official guidance, and not having documentation for new APIs is considered a PR merge blocker. |
@carlossanlop I understand that I needed to add this to ref and impl and I did that for hashset and sortedset, as well as their respective ref/impl in Immutable. Is there a ref for private core lib? Because if so, it all makes sense to me now as to why I'm struggling to get this to build. I will add the dev comments for certain, but I wanted to clear up where I'm not implementing in a ref vs an impl |
@jkotas @eiriktsarpalis @layomia do you know in which ref file this interface should be declared? |
@carlossanlop I think I found it in System.Runtime, sorry it took me so long to figure that out :( |
No worries, @Jlalond 😸 Glad you found it. |
@carlossanlop macosx runtime seemed to fail, are there any flaky tests/can you bump the build one more time? Looks it failed twice for crypto |
/// Determines whether the current set overlaps with the specified collection. | ||
/// </summary> | ||
/// <param name="other">The collection to compare to the current set.</param> | ||
/// <returns>ture if the currnet set and other share at least one common eleemnt; otherwise, false.</returns> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <returns>ture if the currnet set and other share at least one common eleemnt; otherwise, false.</returns> | |
/// <returns><see langword="true" />if the current set and other share at least one common element; otherwise, <see langword="false" />.</returns> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eiriktsarpalis I made a tiny edit to your suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carlossanlop should I apply these langwords to all instances of true/false while I'm at it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure, that would be great, thank you. true
, false
and also null
.
I think it would be a reasonable and useful addition, but it probably needs to go through api review, since it was not scoped in the original proposal. What say you @terrajobst? |
Wouldn't that be a breaking change? |
@stephentoub Can you explain why you think it's a breaking change? Is it because the old call sites would now be defined by an interface? |
e.g. as a source breaking change example, imagine you have this: interface A { void Bar(); }
public class C : A
{
void A.Bar() { }
} Now I come along and add: interface B { void Bar(); } and change A to inherit B. C will no longer compile. |
@stephentoub Makes absolute sense, as which method to call, I only ask because To clarify what I mean, In your above example, only C is defining |
Sorry, I don't understand the question. Can you write out the code for what you're asking? |
@stephentoub From:
To:
|
|
@stephentoub Awesome, thank you for explaining. So we're not adding to |
It's listed on the API review feedback already. It's unfortunate that the other immutable interfaces all extend their read-only counterparts because we can't do that for the new I think we should still implement |
Added to immutable set and spec Spacing for Spec Drop code snippets that I re-added accidentally during rebase Re add code snippets that I dropped instead of squashed
@eiriktsarpalis @layomia Hey guys, rebased on top of master and looks like it's building. If I could get another review I'd appreciate it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for your contribution.
@eiriktsarpalis No thank you! Without help of you, Joe and @carlossanlop I wouldn't have figured I needed a ref in |
What release will this PR make it into? |
It should already be available in some of the .NET 5 previews. I run preview 5 on my machine and it's there. |
Finally... 👏👏 May I suggest |
#2293