Making "super" work outside a literal?

Mariusz Nowak at
Tue Jun 21 01:55:47 PDT 2011

Peter Michaux wrote:
> On Mon, Jun 20, 2011 at 3:23 PM, Axel Rauschmayer <axel at>
> wrote:
>> What is the use case for sideways calls? Can you point me to an example?
> You want to allow the API (a.k.a. public methods) of an object to be
> overridden, but you don't want the functionality of any non-overidden
> API methods to change. In short, you want to avoid the template
> pattern. I gave a synthetic example in the sideways calls thread I
> started.


I'm actually not sure about that. I would even say that allowing such
sideway calls within 'instance' methods would be bad hint. I wouldn't like
to approach following code, it doesn't allow to extend A the way I may need

var A = function () {};
A.prototype = {
	one: function () {
		return, args...);
	two: function () {

If we definitely need to call A.prototype.two whether we extended A or not,
then we probably talk about 'static' method which should not be called on
instance and should be defined directly on A (or privately within closure),
then we may just call it A.two(args...). At least that's what my OOP
experience says.

I understand your example at
to me it's just programmer mistake that should throw error.
Maybe you're looking for some pattern that can be realized using 'static'
methods (?) but forcing or introducing such behavior somewhere close 'this'
or 'super' logic might not be what people expect. My experience is not that
vast, is there any language that provide sugar for such calls ?

Mariusz Nowak
View this message in context:
Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at

More information about the es-discuss mailing list