Minimalist (why) classes ?

John J Barton johnjbarton at johnjbarton.com
Sat Nov 12 13:07:43 PST 2011


On Sat, Nov 12, 2011 at 11:53 AM, Brendan Eich <brendan at mozilla.com> wrote:
> On Nov 12, 2011, at 4:38 AM, Quildreen Motta wrote:
>
> On 11/11/11 23:44, John J Barton wrote:
>
> On Fri, Nov 11, 2011 at 4:48 PM, Brendan Eich<brendan at mozilla.com>  wrote:
>
> On Nov 11, 2011, at 4:42 PM, John J Barton wrote:
>
> Object.extend() does not exist.
>
> Which one do you mean?
>
> I mean Object.extend does not exist.
>
> Irakli is using Function.prototype.extend, not something like PrototypeJS's
> Object.extend.
>
> Iraki wrote Object.extend().
>
> `Object' is a function, though. So it shares stuff from the
> Function.prototype object :3
>
> That's right. My point is that Irakli's .extend is quite different from
> PrototypeJS's, contrary to what John seemed to assume.

Irakli proposed his extend() for the same set of use cases covered by
PrototypeJS's extend(): creating objects from prototypes. As Irakli
says above his defn:
---
// There is nothing new here, just standardizing what libraries already do
// today, in a similar manner as Function.prototype.bind was standardized for
// ES5.
---
Of course his extend() is not Prototype's extend(), or Crockford's or
Hewitt's, or Resig's, etc, etc. That's exactly the problem.

> IINM Irakli has a gist that defines Object.prototype.extend, which is
> inherited of course by Function.protoytpe and all functions (unless shadowed
> or cut off via null __proto__). But this .extend is not the two-argument one
> that does "Swiss inheritance"
> (http://www.crockford.com/javascript/inheritance.html).

This kind of discussion illustrates my point: JS is not sweet enough
because we are missing core operations for constructing prototypes in
a standard way.

jjb


More information about the es-discuss mailing list