Minimalist (why) classes ?

John J Barton johnjbarton at
Sat Nov 12 21:25:03 PST 2011

On Sat, Nov 12, 2011 at 4:15 PM, Jake Verbaten <raynos2 at> wrote:
>> Let's argue about specifics or we'll get nowhere. Do you think Irakli's
>> selfish.js extend (
>> is the way to go, or Prototype's quite different form?
> I'd personally prefer Prototype's extend because it actually extends an
> object rather then creating a new object whom's [[Prototype]] is the
> extended object.

We could start by classifying the existing solutions. Perhaps there
are better terms, here is my start:
  "shallow" vs "deep" usual defn:
  "merge" colliding properties are resolved by selecting a winner,
typically the left most object
  "flatten" the properties of the [[Prototype]] (proto-linked objects)
become 'own' properties of the result
  "own" the own-properties are used

Prototype's two argument extend():
   produces an object equal to the "flatten shallow merge"  on the arguments..

Gonzala's gist's multi-argument extend()
  produces a function object with
       a .prototype from "shallow merge own" on the arguments,
       a prototype chain linking this.prototype,
       properties from |this|, and
      a body that creates an object

I agree that calling Gonzala's function extend() might be confusing.
We could all it Object.class() ;-)

I don't agree that Prototype's extend() is clearly a winner

> Even though the latter may be useful, I'd rather have an Object.make or
> Object.createSimple for that.

I think the primitive we need to agree on is the copy.


More information about the es-discuss mailing list