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

Ensure that CreateChecked, CreateSaturating, and CreateTruncating are publicly exposed #71493

Merged
merged 3 commits into from
Jul 7, 2022

Conversation

tannergooding
Copy link
Member

These were meant to be publicly accessible, but interface DIMs aren't available by default on the implementing type, they have to be redeclared to be part of the public API surface.

@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 Jun 30, 2022

Tagging subscribers to this area: @dotnet/area-system-numerics
See info in area-owners.md if you want to be subscribed.

Issue Details

These were meant to be publicly accessible, but interface DIMs aren't available by default on the implementing type, they have to be redeclared to be part of the public API surface.

Author: tannergooding
Assignees: tannergooding
Labels:

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

Milestone: -

@@ -528,6 +528,63 @@ bool IBinaryInteger<byte>.TryWriteLittleEndian(Span<byte> destination, out int b
/// <inheritdoc cref="INumberBase{TSelf}.Abs(TSelf)" />
static byte INumberBase<byte>.Abs(byte value) => value;

/// <inheritdoc cref="INumberBase{TSelf}.CreateChecked{TOther}(TOther)" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Copy link
Member

@stephentoub stephentoub Jul 1, 2022

Choose a reason for hiding this comment

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

We don't have a language mechanism for explicitly invoking the base implementation? That seems like a hole (we probably discussed) that we should address. It's one thing to have a bit of boilerplate that forces us to redeclare the method as a one-liner that just delegates, but having to redo the whole implementation is unfortunate.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, this is a general (and unfortunate) "issue" with DIMs. Ideally the language team comes up with a way to give access to this.

Copy link
Member

Choose a reason for hiding this comment

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

cc: @MadsTorgersen and @jaredpar just to see the impact

Copy link
Contributor

@dakersnar dakersnar left a comment

Choose a reason for hiding this comment

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

LGTM, seems to be the best solution currently available.

@tannergooding tannergooding merged commit 162cca2 into dotnet:main Jul 7, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 7, 2022
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.

None yet

3 participants