On Jun 26, 2011, at 9:29 AM, Brendan Eich wrote:
> On Jun 26, 2011, at 3:05 AM, Allen Wirfs-Brock wrote:
>
>> What property name would be be used in such implicit super calls? A
>> function doesn't know what property name was used to access it.
>
> In the languages and systems that have super()-only, a method always has a
> name.
>
> So we could define "method that can use super" narrowly, as the new syntax in
> object initialiser, or in class body. IIRC you clarified that any nested
> function expression with such a method doesn't get the same super -- indeed
> gets undefined (I think; still some questions here related to |this| binding).
>
>
>> Using an implicit property name in a super call would require that every
>> method call implicitly pass the name used to access the property. This is
>> just like the |here| problem.
>
> No, not if the compiler sees the method name and burns it into the function
> object. Then it's just an internal property, analogous to static super. This
> is what engines do today with named function forms (definitions, named
> function expressions).
I don't follow what you're saying here --
SomePrototype.foo = function() { super() }
Where is the function name hardcoded? Certainly JSC makes no distinction in
behaviour of function expressions in any context. The only time a function
object created by a function expression will have a name, is when the optional
name is provided. That then raises what super() is in the case of
SomePrototype.foo = function bar() { super() }
When this thread initially started my thought was "yes that sounds great!" but
i very rapidly came to the conclusion that non-lexical super just isn't
workable without introducing inefficiencies in all call sites regardless of
whether the dynamic-super feature is used.
--Oliver
>
> /be
>
>>
>> Allen
>>
>> On Jun 25, 2011, at 10:12 PM, Brendan Eich wrote:
>>
>>> On Jun 25, 2011, at 2:10 PM, Brendan Eich wrote:
>>>
>>>> Should we really constrain super calls in methods to be only of the
>>>> same-named method in the superclass? Conciseness is better but the
>>>> restriction seems worse. Is it necessary in Ruby or CoffeeScript?
>>>
>>> Consider also that the ES.next 'super' proposals allow super.baz where
>>> super.baz is a property other than a method. That would not be possible
>>> with 'super'-only.
>>>
>>> /be
>>> _______________________________________________
>>> es-discuss mailing list
>>> [email protected]
>>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss