Support ability to specify that multiple generic type arguments must be distinct
Rekkonnect opened this issue · comments
Alex commented
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
, thestruct
, or theunmanaged
constraint - Consider applying this to more other special constraints like
notnull
,new()
(could be adjusted by the time shapes arrive)
- Example: C<T1, T2> requires that both T1 and T2 suit either the
API Design
TODO