I understand your point, but I am deeply disturbed by the fact that
this syntax modifies all |obj.secret| and |obj[secret]| and
|{secret:value}| within the scope of |private secret;|, including
those that we may not think about.

The following "private obj.secret;" syntax complies with your
non-sigil request, and it addresses all the issues I have met:

function Point(x, y) {
    private this.x, this.y;  // This private statement only has an
influence upon "this".
    this.x = x;
    this.y = y;
    // do stuff...
    return [#.x, #.y];
}

It defines precisely what object has a private name up front, thus
avoiding accidents such as:
var letters = {};
function Point(x, y) {
  private x, y;  // We want this.x and this.y to be private.
  this.x = x;
  this.y = y;
  // ... later that evening...
  letters.x = 'X';
  letters.y = 'Y';  // Oops, these weren't meant to be private names!
}



ps. Merry christmas.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to