class sugar: static inheritance

Brendan Eich brendan at mozilla.com
Wed Jun 8 08:18:10 PDT 2011


On Jun 8, 2011, at 3:41 AM, Kam Kasravi wrote:

> I was wondering if this could be solved in some way without explicitly referencing the particular Constructor. This isn't a static private issue per se, rather a suggestion for an operator that would allow one to reference Monster.allMonsters as Dragon.allMonsters. eg static(Dragon).allMonsters. Although it would probably be more consistent to resolve Dragon.allMonsters in the same way properties on the prototype chain are resolved. So we can probably ignore this suggestion.

No, you're verging on the @ as private member access operator idea. For class-private instance variables we need something like private(this) and private(other), or else this at x and other at x given private member x. A shorthand: @x is this at x (works even in the face of ASI if the binary o at x form has a [no LineTerminator here] restriction on the left of the @).


>> On another topic, it does seem like "protected" is inevitable, doesn't it?
> 
> Which may be a slippery slope :(

We are already on the slope, the question is traction of the "hold here" people vs. "it's fun, slip some more" users (some users will want protected).


> BTW is it premature to ask questions on harmony proposals in their current state? 

Sure.

/be



More information about the es-discuss mailing list