You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method is is fairly ambiguous, since it could mean "equivalence" (= $other is actually the exact same type) or "implication" (= $other is a sub-type of $this).
An alternative name for isSuperTypeOf would be implies. The interface could also reverse the direction of query and have a method isSubTypeOf (or: isImpliedBy). Personally, I'm indifferent to either of these, but would strictly opt for having only one of those methods.
The rules for the built-in types in regards to isSuperTypeOf should be as follows:
Built-in Type
isSuperTypeOf($other) when...
BooleanType
equals($other)
ComponentType
equals($other)
EnumStaticType
equals($other)
EnumType
equals($other)
NumberType
equals($other)
SlotType
equals($other) or $other is one of: StringType, ComponentType
StringType
equals($other)
StructType
equals($other)
UnionType
equals($other) or $other is UnionType with fewer, but compatible members, or $other is any member type of this union
The
TypeInterfacecurrently looks like this:The method
isis fairly ambiguous, since it could mean "equivalence" (=$otheris actually the exact same type) or "implication" (=$otheris a sub-type of$this).So, I'd suggest to change the interface thusly:
An alternative name for
isSuperTypeOfwould beimplies. The interface could also reverse the direction of query and have a methodisSubTypeOf(or:isImpliedBy). Personally, I'm indifferent to either of these, but would strictly opt for having only one of those methods.The rules for the built-in types in regards to
isSuperTypeOfshould be as follows:isSuperTypeOf($other)when...BooleanTypeequals($other)ComponentTypeequals($other)EnumStaticTypeequals($other)EnumTypeequals($other)NumberTypeequals($other)SlotTypeequals($other)or$otheris one of:StringType,ComponentTypeStringTypeequals($other)StructTypeequals($other)UnionTypeequals($other)or$otherisUnionTypewith fewer, but compatible members, or$otheris any member type of this union