#1794 closed defect (fixed)
this.inherited() removed instead of deprecated
Reported by: | Owned by: | sjmiles | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | General | Version: | 0.4 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Moving from 0.3.1 to 0.4 objects created using dojo.lang.declare no longer have a this.inherited() method. To replace it (which is fine) we should deprecate it in 0.4 and then fully remove it in 0.5.
this.inherited() was not experimental or obscure functionality and was even documented in the book, so i don't think it can be ignored.
Filing this after a quick discussion with Alex on IRC.
Change History (8)
comment:1 Changed 14 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 Changed 14 years ago by
comment:3 Changed 14 years ago by
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Doh! OK, I guess we have to deprecate it. (Maybe should change the code so it only prints the deprecation warning once, no matter how many times you call this.inherited()?)
comment:4 Changed 14 years ago by
If this.inherited() is removed, then how should I call a method that I have specialized over? For example, I have an object (or class) foo and it has method meth1(). I want to create an object (or class) bar that also has a meth1() method that conforms to the same API expectations, but performs an additional task (such as logging or updating some datastore). What will be the Dojo-recommended method using dojo.declare() to call foo's meth1() from within bar's meth1()? Please note that I cannot use a second methodname because bar has to be interchangeable with foo and meth1() is part of foo's public and published API.
comment:5 Changed 14 years ago by
see http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book20
basically,
dojo.declare("my.classes.bar", my.classes.foo, { valueForPrototype: 3, methodForPrototype: function(x, y, z) { // do something ... // call inherited method of same name my.classes.bar.superclass.methodForPrototype.apply(this, [x, y, z]); } });
comment:6 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
A "inherited" thunk has been added which emits deprecation warning and calls "_inherited" implementation.
comment:7 Changed 14 years ago by
Resolution: | → fixed |
---|
This.inherited() was removed rather than deprecated because it wasn't available in 0.3.1; it was added after that. Actually, dojo.declare was added after 0.3.1. (Or so I've been told)
If you really need to call it, you can still reference it as _inherited(), but just don't complain if it doesn't work as you expected, or even if it disappears in a future release.