[dojo-contributors] dojo.lang.inherits

Tom Trenka ttrenka at gmail.com
Thu Apr 6 17:46:34 EDT 2006


Funny how?  Do I amuse you? Am I like a clown to you?

:D

OK, enough of the bad mafia jokes...so the key to JS is that the prototype,
and searching through the prototype chain to find the first method or
property signature (depending on scope definition) is what passes for
inheritance in JS.  To call delegation the method of inheritance in JS is
not an inaccurate statement (although it's deceptive), and that's one of the
reasons (making assumptions in Alex's thinking here that might be wrong)
Alex called it "delegate".

Seriously though, this is one of the reasons why I was making the argument
yesterday; it seems like there's a lot of people who come from C++/Java/C#
backgrounds (not you, I've no idea what yours is) that think there should be
a way of calling a super method in JS and get really frustrated when you
can't.  And we can't really think about it the way C# does (I think that's
what Bill was referring to); that's similar but not the same thing.

trt


On 4/6/06, Scott J. Miles <sjmiles at turbophp.com> wrote:
>
> First off, to rebut my comment with 'delegation is inheritance' is just
> kind of funny. =P
>
> My training is such that delegation refers to locating a method call
> implementation at run-time on an object. The system of locating a particular
> method through a prototype chain may be called delegation, but the process
> of construcing a new object type by creating a new link in a prototype
> chain, adding or overriding properties, and managing initialization is
> something greater.
>
> If you wanted to rename dojo.event.connect to dojo.event.delegate, I would
> say that is clearly correct. IMO, dojo.lang.inherits is JavaScript-style
> inheritence.
>
> If you want to call it cloneAndExtend or something, I can't argue, but it
> seems like pedantry.
>
> Regards,
> Scott J. Miles
> TurboAjax Group
> http://www.turboajax.com
>  ------------------------------
> *From:* dojo-contributors-bounces at dojotoolkit.org [mailto:
> dojo-contributors-bounces at dojotoolkit.org] *On Behalf Of *Tom Trenka
> *Sent:* Thursday, April 06, 2006 11:11 AM
>
> *To:* dojo dev.
> *Subject:* Re: [dojo-contributors] dojo.lang.inherits
>
> Scott--
> What are you referring to, Sandro's link or JS?  Delegation *is* the
> inheritance model in JS, that's what the prototype system implements...
>
> trt
>
> On 4/6/06, Scott J. Miles <sjmiles at turbophp.com> wrote:
> >
> > IMO, what we have here is a type of mass delegation, potentially an
> > entire
> > interface's worth. Additionally, where the new object does not contain a
> > new
> > implementation of a method, it acquires the superclass method (or any
> > property). Overall, I would say this is more generally an inheritence
> > operation.
> >
> > Regards,
> > Scott J. Miles
> > TurboAjax Group
> > http://www.turboajax.com
> >
> > -----Original Message-----
> > From: dojo-contributors-bounces at dojotoolkit.org
> > [mailto:dojo-contributors-bounces at dojotoolkit.org ] On Behalf Of Sandro
> > Magi
> > Sent: Thursday, April 06, 2006 4:43 AM
> > To: dojo dev.
> > Subject: Re: [dojo-contributors] dojo.lang.inherits
> >
> > +1 to delegate.
> >
> > It's closer to the proper concept.
> >
> > Sandro
> >
> > Alex Russell wrote:
> > > To address Jesse's point, how about a name like:
> > >
> > >       dojo.delegate(subclass, superclass, { ... });
> > >
> > > ?
> > >
> > > On Wednesday 05 April 2006 5:33 pm, Scott J. Miles wrote:
> > >> dojo.defineClass(subclass, superclass, { constructor: ..., param1:
> > >> ..., func1: ... });
> > >>
> > >> +1
> > >>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 4/5/2006
>
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20060406/956e3950/attachment.htm 


More information about the dojo-contributors mailing list