On Sep 24, 2009, at 3:55 PM, Charles Jolley wrote:
Given your example, a named function expression would do the job
trivially:
ClassB = ClassA.extend({
foo: function foo() {
foo.base.apply(this, arguments); // calls super!
// other code
}
});
This works but, as I said, this approach has a couple of drawbacks:
1. The function has to be named twice (foo: function foo()). This
makes the code harder to read (especially with long names) and its
not very developer-friendly since its pointless cruft.
2. This is also fragile. If you forget the second name, the code
would still parse but it will be seriously broken. Additionally, if
you decided to rename the function you would also have to edit the
code on the inside. Hurts the "copy and paste" aspect of it.
In general I think this particular approach is not developer
friendly enough.
The function expression name is fairly irrelevant, so you could have a
standard style guideline
foo : function callee() {
callee.base.apply ...
}
--Oliver
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss