[meta] Implement typed objects
|Cc:||Blocked By:||#147, #148, #149, #150, #151, #258, #259, #260, #393, #505, #506, #507, #510, #517, #1772, #1773|
Description (last modified by trev)
One way to improve performance and memory efficiency would be typed objects. Now this proposal isn't implemented in any browsers yet, also the proposal doesn't match our needs exactly. So we should create our own implementation, a subset of the proposal with a few deviations:
- Implement ClassType rather than StructType. Properties with functions as their values should turn into methods. An additional parameter should specify metadata, e.g. constructor and destructor functions.
- Classes should inherit from each other, with the TypedObject class being the common ancestor. For any property requiring a class as value it should be possible to use its subclass.
- Instantiation using type.new() instead of callable types - the latter would require messing with the deprecated __proto__ property which shouldn't be worth it.
- No automatic garbage collection (cannot be implemented), instead all objects should have a .free() method to trigger manual destruction.
- A string type needs to be implemented as an array of uint16 characters.
- Dictionary types need to be implemented in addition to array types: string keys, a fixed type as value.
What to change
Change History (27)
comment:1 Changed 13 months ago by trev
- Summary changed from [meta] to [meta] Implement typed objects