MeAmAnUsername / pie

Pipelines for Interactive Environments
Apache License 2.0
0 stars 0 forks source link

Allow comparing two tuples if all element types are subtypes #200

Open MeAmAnUsername opened 3 years ago

MeAmAnUsername commented 3 years ago

Allow comparing two tuples (T_1, T_2, ..., T_n) and (U_1, U_2, ..., U_n) if T_1 is a subtype of U_1 or vice versa, T_2 is a subtype of U_2 or vice versa, etc.

Example PIE Code:

tup1: (Fruit, Apple) = (banana(), apple());
tup2: (Banana, Fruit) = (banana(), apple());
tup1 == tup2

Current behavior Comparison is disallowed, because the static types of the tuples are not subtypes of each other. Proposed behavior Comparison is allowed, because the element types are subtypes of each other

Reason Two tuples are considered equal if their elements are the same, regardless of their static type. Therefore, it should be possible to compare the two tuples.

Related issues This is the same as #199 but now for tuples

MeAmAnUsername commented 3 years ago

Postponed until #202 is resolved