Complete Minimal Classes

Kevin Smith khs4473 at gmail.com
Fri Apr 6 19:49:34 PDT 2012


>
> I'm not assuming you're a newbie. Heck, I consider myself a
> newbie. Perhaps I'm just jaded. Two weeks ago, I had hope that max-min
> would get us something. Now I'm feeling less hopeful.
>

No way - we're gonna get classes in.  : )


> Arbitrary prototype properties is surely to draw fire. It can be a
> foot-gun and might conflict with instance properties in the future.
>

Foot gun: yes.  I've shot myself in the foot with it.  But I think it can
be addressed in a way that's footgun-proof.  We're going to need arbitrary
prototype properties at some point.  I can elaborate on why I think so
later.  As for conflicting with instance initializers, our footgun-proof
syntax wouldn't need to conflict with that.

As for your fourth, most controversial point, separating call and
> constructor would diverge from the existing pattern. Number() and new
> Number() always call the same function.
>

They don't always do the same thing though - check out Date (15.9.2 &
15.9.3).

Otherwise, we have to do something painful like:

    if (this instanceof MyClass)
        // construct it
    else
        return new MyClass(...args);



> I'm not trying to shut you down. I just really want classes to happen,
> even if in the most minimal form. I apologize if I seem dismissive, I just
> don't see it as being the most productive way of getting there.
>

No problem!  The "half-baked" thing was a little over the top, I admit.  : )

kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120406/90365fdd/attachment.html>


More information about the es-discuss mailing list