Page MenuHomePhabricator

Change reference objects to use prototypal inheritance
Closed, ResolvedPublic

Description

Change reference objects to use standard JavaScript prototypal inheritance. Use methods attached to the prototype, rather than every object. It currently uses this style (attaching to each object), which we should switch away from:

this.getIcon = function () {

We should use OOjs for this (not OOjs UI yet, though).

Event Timeline

Sophivorus triaged this task as Medium priority.Oct 14 2016, 6:37 PM
Sophivorus updated the task description. (Show Details)
Sophivorus lowered the priority of this task from Medium to Lowest.Oct 25 2016, 4:50 PM

I hardly understand this request, and I don't see any benefits to it.

Sophivorus changed the task status from Open to Stalled.Oct 31 2016, 7:30 PM

Stalled until further explained.

The idea is that prototypal inheritance, e.g.:

proveit.Reference.prototype.foo = function ( bar ) {

(as used in OOjs and other JS code bases) may be more understandable (especially to JS developers just starting with the ProveIt code base), standard, and maintainable. I recall I ran into one or two code issues due to this kind of inheritance, but I don't recall the exact details.

Sophivorus changed the task status from Stalled to Open.Feb 5 2017, 10:18 PM

Thanks for the clarification.

Sophivorus closed this task as Resolved.EditedAug 29 2025, 12:40 PM
Sophivorus claimed this task.

Hi! I looked into this and did a few tests, but I found the prototype syntax really ugly and confusing, so I ended up switching to the more modern classes which rely on prototypes internally (so the methods are no longer attached to every object) but have a much more palatable syntax (at least to my taste). Can be tested in the development version (see my common.js) and will be deployed in a few days.