[dojo-contributors] dojo.lang.inherits

Alex Russell alex at dojotoolkit.org
Wed Apr 5 21:12:19 EDT 2006


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
>
> 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 Bill
> Keese Sent: Wednesday, April 05, 2006 5:25 PM
> To: dojo dev.
> Subject: Re: [dojo-contributors] dojo.lang.inherits
>
> >> 2. there is no separation between constructor initialization and
> >> instance initialization.
>
> The suggestion is something similar to this, right?
>
> dojo.inherits(subclass, superclass, fnInit); dojo.extends(subclass, {
> param1: ..., func1: ... } );
>
> (where fnInit is the constructor in the java sense of the word)
>
> This is really abusing the meaning of "inherit".  Wouldn't it be
> better to combine these two functions into one function like this?
>
> dojo.defineClass(subclass, superclass, fnInit,
>   { param1: ..., func1: ... });
>
> As a matter of fact, Alex has already done this for widgets (see
> http://archive.dojotoolkit.org/nightly/src/widget/Dialog.js )
>
> PS: alternately you could use this syntax:
>
> dojo.defineClass(subclass, superclass,
> 	{ constructor: ..., param1: ..., func1: ... });
>
> > I'd be interested in your thoughts on this:
> >
> > http://dean.edwards.name/weblog/2006/03/base/
> >
> > I wrote it to alleviate some of the problems you refer to below.
> >
> > -dean
>
> Yeah, there was some discussion about this and some objections about
> not staying true to javascript, but I didn't really understand it. 
> (The current dojo stuff is just a thin wrapper on top of javascript
> and people wanted to keep it that way, but not sure why.  Maybe just
> philosophical reasons.) Hopefully someone can explain in more detail.
>
> Bill
>
> > On 5 Apr 2006, at 23:51, Scott J. Miles wrote:
> >
> > At the Dojo meeting today (4/5/2006), dojo.inherits came up and we
> > agreed to open up the discussion to the general contribs list.
> >
> > There are two (arguable) faults in the dojo.inherits
> > implementation:
> >
> > 1. invoking super class methods is wordy and inconvenient.
> > 2. there is no separation between constructor initialization and
> > instance initialization.
> >
> > There is general agreement that we want to 'let JS be JS'.
> >
> > With regard to (2), my personal opinion is that JS doesn't have an
> > axe to grind with respect to initialization, and there is nothing
> > un-JS about supporting a systemic instance initialization function
> > (that is to say, a standard way of specifying an instance
> > initializer).
> >
> > Alex seemed right-away to have an idea of how tweak dojo.inherits
> > to add such a feature (yay). We briefly discussed adding additional
> > parameters to inherits vs. a key-word style signature. I prefer the
> > former, but there was no general agreement.
> >
> > There was some talk about the term 'inherits' implying a non-JS
> > idiom, but this is not a problem IMO. Any suggestions for new
> > nomenclature are appreciated.
> >
> > Re (1), nobody seemed to have a handle on how to make calling
> > inherited/parent/base-class methods easier. Morris has developed
> > his own inheritence system that may provide a solution.
> >
> > Thanks for listening. :)
> >
> > Regards,
> > Scott J. Miles
> > TurboAjax Group
> > http://www.turboajax.com

-- 
Alex Russell
alex at jot.com
alex at dojotoolkit.org BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20060405/11c6fa25/attachment.sig 


More information about the dojo-contributors mailing list