Type System Refactor
This MR refactors the type system to avoid multiple creation of data type instances by caching them. This improves the performance of comparing types, avoids unnecessary copies, and increases general efficiency of data type handling.
- Introduce the metaclass
PsTypeMetawhich keeps track of all existing instances of subclasses ofPsType, and alters class instantiation to return existing instances instead of creating new ones - Refactor
__eq__and__hash__, which are now implemented inPsTypeand use an__args__method implemented by each instantiable subclass - Fix
constify/deconstifyto no longer copy their arguments, but memoize their return values - Refactor and extend documentation of the type system to reflect the changes
Some minor additions come along:
- Move
create_typefromtypes.quicktotypes.parsing - Rename
types.basic_typestotypes.types - Move
PsType,constifyanddeconstifytotypes.meta - Add an inheritance diagram to the type system documentation