shortcuts for defining block-local private names, plays nicely with @foo syntax

Axel Rauschmayer axel at
Mon Jan 23 01:21:45 PST 2012

> It seems like an unfortunate inconvenience to require any code refactoring and lose the shorthand @ this-access if you just want to make a private property on an object be public.  Instead of just restricting the token to the right of a @ or .@ construct be a private name, perhaps it would be useful to also permit an explicitly declared public name?

I wouldn’t mix public and private, but it would be nice to have symmetry – only having a `this` shortcut for private names feels odd. How about the following?

    function Point(everyone, secret) {
        this.everyone = everyone;
        this. at secret = secret;

    //---- Short:

    function Point(everyone, secret) {
        .everyone = everyone;
        . at secret = secret;

    //---- Shorter:

    function Point(this.everyone, this. at secret) {

    //---- Shortest:

    function Point(.everyone, . at secret) {

To me, consistency is much more important than saving characters.

Dr. Axel Rauschmayer
axel at


More information about the es-discuss mailing list