On Wed, Jun 22, 2011 at 2:10 PM, Brendan Eich <bren...@mozilla.com> wrote:
>> Yes, functions have static scope, but functions (and all objects) do
>> not have static owning objects,
> The scope in ES1-5 can be an object, the global object. Your use of "owning" 
> here either covers that case, in which your claim is false, or you need to 
> define it better.

By "owning object" I mean an object which has the function (or
arbitrary object) as one (or more) of its properties.  Regardless of a
function's scope, it may have multiple owning objects, one of which
may be the global object, as opposed to a single permanent (static)
owning object.

> Many functions are used only as methods via prototypal inheritance, stored in 
> one object (the prototype). Capturing that object's [[Prototype]] 
> unambiguously via 'super' is useful. If it doesn't cover the dynamic case, 
> use Object.defineMethod.
>> they are free to be passed around and
>> assigned as desired, this is what a static super breaks.
> "breaks" is too strong. Object.defineMethod as a hard-case solution is being 
> discussed. It's not the end of the world.

I don't think of assigning functions dynamically and to multiple
objects is a "hard case" I think it's pretty common.  Requiring
Object.defineMethod for these cases is inconvenient, and the assigner
may not even know if the function uses 'super'.  Also, see my previous
comments to Allen regarding Object.defineMethod.

> The cost is naively an extra push or register, which is big enough that I can 
> promise you: engine implementors will reject this.

If this is true then dynamic super will not work, I am not
knowledgeable enough about implementations to argue here.

Is there no per-call cost whatsoever to adding static super?

> Want to clarify one thing: 'super' in the classes proposal has well-defined 
> static meaning. I don't think you are trying to change that -- tell me if I'm 
> wrong. 'super' in functions or methods in an object literal is what you're 
> talking about.

I'm talking about |super| working in any function and having property
access work with it as I think Allen is as well with the combination
of object literal super and Object.defineMethod.

Sorry for any earlier rehashing, I didn't realize we agreed on those points.

Thanks,
Sean Eagan
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to