-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Anything that is in type.h and is not meant to be used externally should be removed from the header or added to a dedicated namespace. Any non-static member functions which do not access Type internals can be made free functions. Any inconsistent function names should be renamed.
This is a refactor ticket, but it an important one to do, since leaving these methods in the public API allows users to write subtly incorrect or incomplete code - such as if they used narrowField instead of the differentiated narrowPath, which means their inferences will only work with paths with 1 component. It is fine to also improve doc comments where lacking to guide towards the correct APIs.
Here's some things to consider:
- TypeSet should only be used when absolutely certain that an object shape will never be needed in the code, and when the user cares about saving 8 bytes. So far we've not had a genuine need to use it.
- narrowField can be removed - it was added before we had the narrowPath implementations for the matcher and expressions
- sameCanonicalClass can be moved to detail namespace
- sameCanonicalClasses is not consistent with orderedComparisonTypes in naming. Rename sameCanonicalClasses to drop the "classes".
- Propose how to address the inconsistency unionType, intersectType, complement (no type).
- Type::canPathBeArray is a member, but getPathType is a free function. We should move canPathBeArray to a free function too, since it doesn't need to be a member.