Finding a "safety syntax" for classes

Brendan Eich brendan at mozilla.org
Sun Mar 25 10:30:05 PDT 2012


David Herman wrote:
>      class Vector {
>          /* various methods... */
>
>          forEach = Array.prototype.forEach; // just an example, don't bikeshed me
>
>          /* more methods ... */
>      }

Perhaps we are overreacting to the footgun of the proto-shared mutable 
object defined via a data property. Of course one can shoot at toes 
imperatively after the class declaration. And functions are mutable 
objects, so methods are a special case we bless even in the most minimal 
classes proposals!

Still, I prefer to defer anything like the above (and of course, defer 
the better traits thinking you showed).

/be


More information about the es-discuss mailing list