[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-09 Thread Jim Higson
On Tuesday 08 September 2009 16:18:20 T.J. Crowder wrote: @Jim, Ie, Class.create takes any number of objects of functions or functions. If functions, the function name is used. I see where you're coming from, but FWIW I'm with Allen on this one. Also, there's no standard way to get the

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-09 Thread Jim Higson
On Wednesday 09 September 2009 09:02:28 Jim Higson wrote: I see where you're coming from, but FWIW I'm with Allen on this one. Also, there's no standard way to get the name of a function until ECMAScript5 (which standardizes the truly outrageous idea that function instances should have

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-09 Thread T.J. Crowder
Hi all, I thought of a wrinkle today: Mixins. This new mechanism modifies function instances if they override base class functions (it leaves them alone if they don't). So if you mix in something that has a function with the same name as a parent class's function, we will set a $super

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-09 Thread Allen Madsen
TJ, I don't particularly think this is a problem or even a new problem (wouldn't the current let you do this as well?). This sounds like protecting the developer from themselves. I think as long as you sufficiently state what will happen in a particular instance then it is perfectly reasonable

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-09 Thread Robert Kieffer
I'm with Allen on this. I don't think it's uncommon for mixins to want to hook into existing functionality. This is trivial if they can invoke $super (the original object's method), and problematic otherwise. To give a concrete example, a while ago I implemented a Selectable mixin for some

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-09 Thread T.J. Crowder
Hi Allen, Thanks. I agree, it's a very edgy edge case. :-) (wouldn't the current let you do this as well?) Actually, it works in the current implementation, because if a mixin function uses $super (which again is a bit odd), addMethods wraps it up in a closure and never modifies the actual

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-09 Thread kangax
On Sep 9, 7:29 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi all, I thought of a wrinkle today: Mixins. This new mechanism modifies function instances if they override base class functions (it leaves them alone if they don't). So if you mix in something that has a function with

[Prototype-core] Re: A more efficient $super for Prototype 2

2009-09-09 Thread T.J. Crowder
Hi Robert, That's a very interesting use case, thanks for that. I can certainly see the utility of that, and in fact as I was writing all of this up for my (pathetic little) blog I was getting increasingly uncomfortable with the mixin issue. If it's important for mixins to participate in