Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#1794 closed defect (fixed)

this.inherited() removed instead of deprecated

Reported by: robert.coup@… 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 13 years ago by bill

Resolution: wontfix
Status: newclosed

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.

comment:2 Changed 13 years ago by liucougar

it looks to me that, dojo.declare and dojo.inherited are both introduced pre-0.3.0:

in r3803, dojo.declare was added, while dojo 0.3.0 is r3978

comment:3 Changed 13 years ago by bill

Resolution: wontfix
Status: closedreopened

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 13 years ago by rob.kinyon@…

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 13 years ago by robert.coup@…

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 13 years ago by sjmiles

Resolution: fixed
Status: reopenedclosed

A "inherited" thunk has been added which emits deprecation warning and calls "_inherited" implementation.

comment:7 Changed 13 years ago by bill

Resolution: fixed

(In [6519]) Merge [6518] to 0.4.1 branch. Fixes #1794.

comment:8 Changed 13 years ago by (none)

Milestone: 0.4.1

Milestone 0.4.1 deleted

Note: See TracTickets for help on using tickets.