3 Different Kinds of Prototypal Inheritance: ES6+ Edition
Eric Elliott
1.1K15

I have a framework which supports LOTS of objects (91 million once). One way to reduce the size of the objects is to have TWO objects with variables:

  1. The per-instance variables that change amongst objects: x, y for example.
  2. A “static” set of variables that are shared by all objects. Color sometimes is shared, Shape often, TextColor almost always .. and so-on

I can reasonably build this with proto techniques: have the static object “shimmed” just under the instance vars.

It seems a bit odd tho and I wonder if this has come up with StampIt style programming? The advantages of the statics is that if you look for a variable not in the top level, instance variable object, it will be found in the second level, static/default level.

Like what you read? Give Owen Densmore a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.