I completely agree. I got wrapped up into theory and what ifs while digging
into the framework.

I actually spent a good part of last night trying to think of a good example
case. I was unable to locate a single scenario that was more appropriately
solved by a different design pattern.

Nathan

On Fri, Oct 10, 2008 at 11:54 AM, nutron <[EMAIL PROTECTED]> wrote:

>
>
> I agree. If you have an inheritance scheme that needs to skip a generation
> to
> get back to the original class, your design needs to change. This kind of
> thing only makes code harder to understand. I suggest you break your logic
> out into more methods so that you can call them without this kind of
> pattern.
>
>
> ibolmo wrote:
> >
> >
> > Why would you want the base?
> >
> > Olmo
> >
> > On Oct 9, 8:49 am, "Nathan White" <[EMAIL PROTECTED]> wrote:
> >> The reworking of class looks great.
> >>
> >> I realize that its best to use shallow inheritance in javascript for a
> >> number of reason but on several occasions I have created a classes that
> >> are
> >> extended 2-3 levels deep. I understand that this is not a common
> scenario
> >> but in these situations I have had the need to refer to the 'base'
> method
> >> and not the 'parent'.
> >>
> >> What do you think of the following code replacing line
> >> 86-88<
> http://github.com/mootools/mootools-core/tree/master/Source/Class/Cla...>
> >> .
> >>
> >>     if (caller){
> >>         object.parent = function(){
> >>           return arguments.callee.caller.__parent.apply(this,
> arguments);
> >>         };
> >>
> >>         object.base = function(){
> >>             var p = arguments.callee.caller;
> >>             while($type(p.__parent) == 'function') p = p.__parent;
> >>             return p.apply(this, arguments);
> >>         };
> >>     }
> >
> >
>
>
> -----
> The MooTools Tutorial:  http://www.mootorial.com www.mootorial.com
> CNET Clientside:  http://clientside.cnet.com clientside.cnet.com
> --
> View this message in context:
> http://n2.nabble.com/re%3A-class-inherit-suggestion-tp1312639p1316732.html
> Sent from the MooTools Users mailing list archive at Nabble.com.
>
>

Reply via email to