Classes: suggestions for improvement

Juan Ignacio Dopazo dopazo.juan at gmail.com
Mon Jun 13 08:41:26 PDT 2011


On Mon, Jun 13, 2011 at 12:01 PM, Kam Kasravi <kamkasravi at yahoo.com> wrote:

>
> On Jun 13, 2011, at 1:55 AM, Axel Rauschmayer <axel at rauschma.de> wrote:
>
> Indeed a number of frameworks use 'initialize' for their 'ctor'. I imagine
> this has been
> heavily discussed within TC39, but perhaps some of the rational has not
> made es-discuss.
>
> It was posted somewhere... The rationale is that 'constructor' is already a
property of the prototype that points to the constructor function.

function Test() {}
(Test.prototype.constructor === Test) // true

It was chosen to replace 'new' because o.new() is correct under ES5.

 On Sun, Jun 12, 2011 at 10:17 PM, Brendan Eich <brendan at mozilla.com> wrote:

>
> I'm not sure classes should grow to have private class or prototype
> variables in ES.next. Mark stripped things down to help get classes in. The
> one reason I come back to them: private methods for common subroutining are
> frequent in practice. So YAGNI doesn't work. One can always closure- or
> module-wrap by hand; that's the counterargument.
>
> /be
>
> I'm not sure that's a counterargument. The whole point of the classes
proposal is to simplify the use of a common pattern. Private methods for
subroutines are a very common use case.

Juan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110613/5b0dd985/attachment.html>


More information about the es-discuss mailing list