Erik Corry (2011-05-18T09:46:12.000Z)
domenic at domenicdenicola.com (2013-12-13T23:08:41.054Z)
2011/5/18 Luke Hoban <lukeh at microsoft.com>: > The Private Names strawman currently combines a new runtime capability > (using both strings and private names as keys in objects) with several new > syntactic constructs (private binding declarations, #.id). At the March > meeting, I recall there was some support for the idea of separating these > two aspects, and exposing the runtime capability also as a library that > could be used in ‘text/javascript’. > I'd like to support this idea. Your example looks a bit wrong to me though. It seems to make new private names per object. Surely we want a private name per 'class' instead. ```js var Point = (function() { var _x = Object.createPrivateName(); var _y = Object.createPrivateName(); var Point = function(x, y) { this[_x] = x; this[_y] = y; } Point.prototype.myMethodUsing_xAnd_y = function() {...} return Point; })() var p = new Point(1, 2); ```