Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Support ability to specify that multiple generic type arguments must be distinct #41

Open
Rekkonnect opened this issue Jul 26, 2021 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@Rekkonnect
Copy link
Owner

Rekkonnect commented Jul 26, 2021

Title currently sucks but the meaning is conveyed in some way or another

Functionality Design

This feature enables the end user to prevent usage of a type with type arguments that may match some criteria, with regards to other type arguments. For example, the currently considered possibilities are:

  • Different type arguments (T1 != T2)
    • Example: C<T1, T2> may be specified in a way where replacing both T1 and T2 with the same type argument is prevented
  • Non-related type arguments (T1 must not inherit T2)
    • Example: C<T1, T2> may be specified in a way where replacing T1 with a type that inherits T2 is prevented
    • Could also further specify that it would only check class inheritance tree, disregarding potentially mathcing interfaces
  • Type arguments' size must match or be related (sizeof(T1) == a * sizeof(T2))
    • Example: C<T1, T2> may be specified in a way where T1's size is equal to that of T2, or a fixed multiple of it
  • Type arguments both matching the same special constraints (class, struct, unmanaged)
    • Example: C<T1, T2> requires that both T1 and T2 suit either the class, the struct, or the unmanaged constraint
    • Consider applying this to more other special constraints like notnull, new() (could be adjusted by the time shapes arrive)

API Design

TODO

@Rekkonnect Rekkonnect added the enhancement New feature or request label Jul 26, 2021
@Rekkonnect Rekkonnect added this to the 2.0 milestone Jul 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant