Opened on 04/04/2014 at 10:41:21 AM
Closed on 05/12/2014 at 09:57:03 AM
#260 closed change (fixed)
[Typed objects] Implement type inheritance
Reported by: | trev | Assignee: | trev |
---|---|---|---|
Priority: | P2 | Milestone: | |
Module: | Core | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #145 | Platform: | |
Ready: | yes | Confidential: | no |
Tester: | Verified working: | no | |
Review URL(s): |
Description (last modified by trev)
Background
See #145. The ECMAScript Harmony proposal doesn't include any type inheritance mechanism but we'll need it.
What to change
An API like the following should work:
const Point2D = new ObjectType({x: uint32, y: uint32}); const Point3D = Point2D.extend({z: uint32});
It should be possible to use the subclass wherever its superclass is required (especially for typed properties). One implication is that property overriding cannot be supported - a property with given name should have the same type both in the subclass and its superclass.
It probably makes sense to have a predefined ObjectBase type as a common ancestor of all objects, so new ObjectType(...) would be equivalent to ObjectBase.extend(...). That type can be used for "untyped" references that can store objects of any time. It can also define properties that will be common to all types like .equals().
Attachments (0)
Change History (4)
comment:2 Changed on 04/17/2014 at 08:49:23 PM by trev
- Description modified (diff)
- Owner set to trev
- Status changed from new to assigned
comment:3 Changed on 04/22/2014 at 03:33:57 PM by trev
- Review URL(s) modified (diff)
- Status changed from assigned to reviewing
comment:4 Changed on 05/12/2014 at 09:57:03 AM by trev
- Resolution set to fixed
- Status changed from reviewing to closed
Fixed: https://hg.adblockplus.org/adblockpluscore/rev/2648c6fc70c1