Skip to content

Consider hiding legacy overloads for Math.DivRem #44829

Closed

Description

@SingleAccretion

Background and Motivation

#42156 introduced some new overloads for Math.DivRem which follow more modern API design practices (and have way better naming). I think it would make sense to hide the existing ones to avoid potential confusion and save on some Intellisense real estate. The new overloads are functionally the same.

Proposed API

namespace System
{
    public static class Math
    {
+       [EditorBrowsable(EditorBrowsableState.Never)]
        public static int DivRem(int a, int b, out int result);
+       [EditorBrowsable(EditorBrowsableState.Never)]
        public static long DivRem(long a, long b, out long result);
    }
}

Risks

The primary risk would be confusion among people who could be surprised to see the existing overloads disappear. I think it is low though, as the new signatures are quite self-explanatory. Note: this change only impacts new code, so it can be expected that developers working on it would familiarize themselves with the new pattern, especially as it is the only one available for unsigned and native integers.

Activity

  1. added
    api-suggestion
    on Nov 17, 2020
  2. added
    untriaged
    on Nov 17, 2020
  3. Dotnet-GitSync-Bot commented on Nov 17, 2020

    @Dotnet-GitSync-Bot
    Collaborator

    I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

  4. added
    api-ready-for-review
    and removed
    api-suggestion
    untriaged
    on Jan 7, 2021
  5. tannergooding commented on Jan 7, 2021

    @tannergooding
    Member

    I've marked this api-ready-for-review so that the design review team can decide if this is appropriate or not.

  6. terrajobst commented on Jan 12, 2021

    @terrajobst
    Contributor

    Video

    This could confuse people multi-targeting for .NET Standard because neither side is now a superset in IntelliSense. The value of hiding also seems low, especially because developers will typically explore alternative overloads and the tuple overloads will show first.

  7. ghost locked as resolved and limited conversation to collaborators on Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-ready-for-reviewarea-System.Numerics

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions