|
RE: protected methods: msg#00439web.dojo.devel
>(also, btw, dojo.defineWidget() doesn't support private variables) Fwiw, there's nothing stopping you from writing code like this in an initializer: function() { var privateKey = "secretKey"; var privateMatchKey = function(inKey) { return (inKey === privateKey); } this.matchKey = function(inKey) { return privateMatchKey(inKey); } } I believe the correct idea is that prototype methods do not support (so-called) private variables (usually expressed as closures on the constructor). Regards, Scott J. Miles TurboAjax Group http://www.turboajax.com > -----Original Message----- > From: dojo-contributors-bounces@xxxxxxxxxxxxxxx > [mailto:dojo-contributors-bounces@xxxxxxxxxxxxxxx] On Behalf > Of Bill Keese > Sent: Friday, October 27, 2006 5:27 AM > To: dojo dev. > Subject: Re: [dojo-contributors] protected methods > > OK, my original mail must have been unclear. Of course > subclasses (or whatever you want to call them) can override > postMixInProperties(). But you'd never have code like this: > > var foo = dojo.widget.createWidget(...) > foo.postMixInProperties(); > > If we were programming in java or C++ then we would make > postMixInProperties() protected. There's no native > javascript support for that (also, btw, dojo.defineWidget() > doesn't support private > variables) but the API doc would be a lot nicer if it didn't list > postMixInProperties() as though it were a method that widget > users (as opposed to widget writers) could use. > > Adam L. Peller wrote: > > ok, I'll bite... as long as we chain up, why can't we > override these? > > postMixInProperties seemed like a good place to do overrides, for > > example. Or is there just a concern that people won't chain up? > > > > On 10/27/06, Bill Keese <bill@xxxxxxxxxxxxxxx> wrote: > >> By the way, I found some good examples of protected > methods (or to be > >> pedantic, methods that subclasses override but that users aren't > >> supposed to call): > >> > >> postMixInProperties() > >> fillInTemplate() > >> postCreate() > >> onResized() > >> > >> etc. > >> > >> We can't very well start putting underscores in front of > those method > >> names now. It would be nice if we had some way to notate their > >> status to the parser though, so those functions showed as > a different > >> color or something. > >> _______________________________________________ > >> dojo-contributors mailing list > >> dojo-contributors@xxxxxxxxxxxxxxx > >> http://dojotoolkit.org/mailman/listinfo/dojo-contributors -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.408 / Virus Database: 268.13.13/500 - Release Date: 10/26/2006 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Re: protected methods: 00439, Adam L. Peller |
|---|---|
| Next by Date: | Re: protected methods: 00439, Tom Trenka |
| Previous by Thread: | Re: Re: protected methodsi: 00439, Adam L. Peller |
| Next by Thread: | Re: protected methods: 00439, Tom Trenka |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |