> Am I right that super-calls only works for class methods, because they know > the, statically determinable, prototype chain of its instances, and therefore > it knows where to start the search.
Yes that’s a tricky problem. There are two solutions: 1. Keep a dynamic variable "here" (similar to "this") that is filled in when invoking the method. You have to traverse the prototype chain to find the method and thus know which object it is in. Advantage: robust with regard to dynamic changes to properties. Disadvantage: high cost, even for methods that don’t use "super" (and it won’t be that frequently used a feature). 2. Statically store in methods what object they come from. This works best with object literals. Consult [1] for the details – it’s an internal property called [[Super]]. In theory, one could also have a property [[Here]], to support accessing sibling properties, but with modules, I don’t think that is a frequent use case. If one uses an object literal for modularity, one has to be careful *not* to use "this" to access siblings. [1] http://wiki.ecmascript.org/doku.php?id=harmony:object_initialiser_super -- Dr. Axel Rauschmayer [email protected] twitter.com/rauschma home: rauschma.de blog: 2ality.com _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

