Skip to content

Conversation

@michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Feb 13, 2023

In this PR we

  • Introduce library support for checked operators (extractor support had already been implemented).
  • Use the stored method name as the function name of an operator instead of hardcoding the name in the QL library code.
  • Add appropriate tests.

There is compile time check that ensures that a regular operator i always defined, when a checked variant is defined.

public class Number
{
    public int Value { get; }

    public static Number operator checked +(Number n1, Number n2) =>
        new Number(checked(n1.Value + n2.Value));

    public static Number operator +(Number n1, Number n2) =>
        new Number(n1.Value + n2.Value);
}

Should we structure this differently: Eg AddOperator could contains all (both checked and regular operators and then CheckedAddOperator could extend AddOperator?

Outstanding tasks

  • Run DCA

@github-actions github-actions bot added the C# label Feb 13, 2023
@michaelnebel michaelnebel force-pushed the csharp/deprecategetassemblyname branch from 5b8db10 to b3c234d Compare February 14, 2023 11:59
@michaelnebel michaelnebel changed the title C#: Use functionname as stored in the database. C#: Checked operator support. Feb 14, 2023
@michaelnebel michaelnebel marked this pull request as ready for review February 14, 2023 12:28
@michaelnebel michaelnebel requested a review from a team as a code owner February 14, 2023 12:28
Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

Excellent!

@michaelnebel
Copy link
Contributor Author

DCA looks good!

@michaelnebel michaelnebel merged commit ff9e738 into github:main Feb 17, 2023
@michaelnebel michaelnebel deleted the csharp/deprecategetassemblyname branch February 17, 2023 07:39
@michaelnebel michaelnebel changed the title C#: Checked operator support. C# 11: Checked operator support. Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants