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

Brian Di Palma offler at
Sun Apr 28 11:34:19 PDT 2013

Another mail that I expected to receive more attention that hasn't...

We're London based so we had attendants at JQueryUK and the announcement of
private class state in ES6 was a surprise, a pleasant one but still surprising.

Is it the case that the announcement was jumping the gun?

Needless to say for programming with large code bases it would be
excellent to have private state.

>From the meeting notes thought it does not seem as if this has been agreed to.

YK: So, what is your proposal?


My proposal is the private symbols get postponed to ES7
WeakMap gets renamed to reflect the inverted thinking
If we adopt the @ syntax in ES6, I want to be able to use a WeakMap on
the right side

...Don't care so much about the renaming, but feel that it could add
clarity to the feature

RW: (Disagree based on experience teaching the concept)

WH: no consensus on class without private symbols

MM: Rick, can you find the history of this?

RW: (recounts two meetings where Waldemar was not present, but a
general consensus existing with the understanding that Waldemar would
still have something to say. At Northeasten, Allen presented @-names,
in which Waldemar found to sufficiently meet his privacy requirement
for classes)

...Discussion around class private state as a whole.

BE: We need to synthesize what's going into ES6. Waldemar claims this
must include some way of adding class private state.

STH: I would like to stop this conversation and allow myself time to
think about this.

BE: Done.


Sam, Mark and Allen to work on "relationships" and varied representation in ES6.

The '@' syntax is not the nicest but it does highlight private state
which is probably a good thing.
I'd happily type "IAMTHEWALRUS" if it gave me private state. Well not
happily; but I'd still type it.

>From the notes it does not seem clear if a lack of private is enough
to scupper classes altogether.
That would seem an extreme step to take, surely private state can be
added in ES7?


Brendan Eich wrote:

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 SkinnedMesh extends 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