On Tue, Jun 21, 2011 at 1:55 AM, Mariusz Nowak
<medikoo+mozilla....@medikoo.com> wrote:
> Peter Michaux wrote:

>> 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
> to:
>
> var A = function () {};
> A.prototype = {
>        one: function () {
>                return A.prototype.two.call(this, args...);
>        },
>        two: function () {
>                ...
>        }
> };

Yes it may seem inconvenient but it is a decision for the the person
creating the class, not the person trying to extend the class.

Peter
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to