On Tuesday 08 September 2009 03:57:13 Allen Madsen wrote:
> TJ,
> I guess I don't understand why it wouldn't work. I'll illustrate how I
> understand it and you correct me where I'm wrong.
> var A = Class.create({
>   nifty: function(){}
> });
> var B = Class.create(A, {
>   nifty: function(){
>     this.nifty.$super(); // refers to A.nifty()
>     //this.nifty(); //would cause recursion
>   }
> });

Wouldn't you have to do this to preserve scope?

this.nifty.$super.call( this );

Myself, I've never liked the .call syntax much because I mistake it with 
apply: the two words seem arbitrary. But, yeah, I can see that pre-binding 
every overridden method of every object would be a big overhead.

Perhaps I would do:

var B = Class.create(A, {
  nifty: function(){

    var $super = this.nifty.$super.bind( this );
    // $super refers to A.nifty() bound to this

[1] Please correct if this is wrong!

my wiki ajaxification thing: http://wikizzle.org
my blog: http://jimhigson.blogspot.com/

You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to