[dojo-contributors] dojo.lang.inherits

Jesse Kuhnert jkuhnert at gmail.com
Wed Apr 5 20:31:16 EDT 2006


I guess I'm being mr. grumpy today, but I had a small thought on this..

I think it's a mistake for dojo devs or users to think of anything going on
in dojo as analgous to another programming language, unless the similarities
are really close. (ie java/ c++ )

The problem with this I think is that when you open that door you find users
(like myself) that see words like "inheritance/constructors/etc" and start
to expect other things to behave like java as well. Like superclass
functions always being called on child classes. This can also lead to what I
think are "impure" thoughts when you're a developer. If you allow yourself
to slip back into thinking the way you did in another programming language
you're not really seeing the "matrix" of the language you're actually coding
in. If the dojo devs aren't see this supposed "matrix" then it seems like
innovation and cool new features that intuitively leverage the JS language
are less likely to come about as a result.


On 4/5/06, Bill Keese <bill at dojotoolkit.org> wrote:
>
> >> 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
> >
> > _______________________________________________
> > dojo-contributors mailing list
> > dojo-contributors at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors
>



--
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.  http://opennotion.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20060405/52ea658f/attachment.htm 


More information about the dojo-contributors mailing list