class-private syntax in ES6 (was: ES6, ES7, ES8 and beyond. A Proposed Roadmap.)

Brendan Eich brendan at
Sun Apr 21 10:22:53 PDT 2013

Trimming cc: list to just es-discuss.

Mark S. Miller wrote:
>   * Completing the class design
>       - at least high integrity and private state

If I'm not mistaken, we need class-private syntax for classes to have 
ultimate double-blind consensus in *ES6*. See last meeting notes.

At JQueryUK, I threw up a sketch in slides based on

|class  SkinnedMeshextends  THREE.Mesh{
   private  identityMatrix,

   constructor(geometry,  materials)  {
     super(geometry,  materials);

     this at identityMatrix=  new  THREE.Matrix4();
     this at bones=  [];
     this at boneMatrices=  [];


The TypeScript (CoffeeScript had it already, and more concisely via @) 
option to declare and initialize via a private prefix on one of 
constructor's parameters would be helpful to many developers:

|class  Point{
   constructor(private x, private y) {}
   add(other) {
     return Point(this at x + other at x, this at y + other at y);

I hope we can agree to do this much for ES6, based on the relationships 
work, which I'd like to thank Tom and you for championing. At first I 
thought it was not helpful, but then the lightbulb went off ;-).


More information about the es-discuss mailing list