Private Names and Methods

Brendan Eich brendan at mozilla.org
Fri Apr 6 10:42:27 PDT 2012


Axel Rauschmayer wrote:
> Multiple inheritance is where things become interesting. In order to 
> implement some kind of mixin or trait mechanism for JavaScript, you 
> would need the ability to copy private members.

Which .{ can do. The argument is that this is safe against unintended 
name leaks because while the LHS (mixin-derived) is an expression, the 
RHS (mixin-base) is a literal.

Is having only the literal-RHS-only special form too restrictive? It 
could be wrapped in an API usable from downrev script, but this means 
implementors of mixins must use ES6 even though consumers can use pre-ES6.

/be


More information about the es-discuss mailing list