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
Currently, all types representing a sequence (collection) extend ComponentType. However, also OptionalType is a ComponentType. A new intermediate empty abstract type uniting all sequence types is proposed, so that:
This will help in determining which types represent a sequence in an extensible way. Up until now, you could check this either by enumerating all seqence types (which will leave some out in the future):
if (typeinstanceofArrayType || typeinstanceofListType|| typeinstanceofListTypeWithShared
|| typeinstanceofOrderedSetType|| typeinstanceofSetType) { }
Or by a more error-prone non-extensible, I dare say incorrect way:
if (typeinstanceofComponentType && !typeinstanceofOptionalType) { }
The latter will cause problems in existing code in the future, when there is another non-sequence ComponentType introduced.
Tasks
create SequenceType and change the inheritance hierarchy
refactor all usages of ComponentType and OptionalType
The text was updated successfully, but these errors were encountered:
Proposition
Currently, all types representing a sequence (collection) extend
ComponentType
. However, alsoOptionalType
is aComponentType
. A new intermediate empty abstract type uniting all sequence types is proposed, so that:Motivation
This will help in determining which types represent a sequence in an extensible way. Up until now, you could check this either by enumerating all seqence types (which will leave some out in the future):
Or by a more error-prone non-extensible, I dare say incorrect way:
The latter will cause problems in existing code in the future, when there is another non-sequence ComponentType introduced.
Tasks
create SequenceType and change the inheritance hierarchy
refactor all usages of ComponentType and OptionalType
The text was updated successfully, but these errors were encountered: