For example (IIRC, that’s what Allen’s class operator does, I’ve also seen 
similar functions on the web):

    function Class(proto) {
        let constr = proto.constructor;
        constr.prototype = proto;
        return constr;
    }
    let Point = Class({
        constructor: function (x, y) {
            this.x = x;
            this.y = y;
        }
    });


On Mar 21, 2012, at 20:00 , John J Barton wrote:

> On Wed, Mar 21, 2012 at 11:52 AM, Russell Leggett
> <[email protected]> wrote:
>> On Wed, Mar 21, 2012 at 2:47 PM, Allen Wirfs-Brock <[email protected]>
>> wrote:
>>> 
>>> 
>>> On Mar 21, 2012, at 8:41 AM, Russell Leggett wrote:
>>> 
>>> 
>>> 
>>> On Wed, Mar 21, 2012 at 11:12 AM, Kevin Smith <[email protected]> wrote:
>>>>> 
>>>>> I think its easier to explain - it will actually result in a constructor
>>>>> on the prototype.
>>>>> The actual constructor function and the .constructor property really
>>>>> should always be in sync - this helps with that.
> 
> So the proposal is that the class body declares a function called
> "constructor" in with other functions that will end up on the
> [[Prototype]] but the instance created from 'new' operating on the
> class function call will have an own property "constructor" that
> points to this function. Will the property also appear on the
> [[Prototype]] under 'constructor'?
> 
> 
> jjb
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
> 

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to