Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Type-safer Diff.Compare at compile time #1176

Closed
@Therzok

Description

@Therzok

Currently, we're allowing Compare with T being any kind of class.

Should we introduce an IDiffResult interface with from which the classes we support as convertible from DiffSafeHandle? Then Diff.Compare<T> would be T : IDiffResult.

This would improve a few aspects:

  • No more runtime issues like this
  • Type-safe and semantic completion support! I always had to check the sources for the types I can get.
  • Customizable from user-side.
  • No need to manually maintain the list (which is also outdated) in the exception message and the transformation list.

I know this would bring an implication that DiffSafeHandle would become public, or we can expose a proxy class with methods which interface the native methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions