> It doesn't seem quite right that an upward call like
> 
>    Object.getPrototypeOf(here).foo.call(this)
> 
> has sugar
> 
>    super.foo()
> 
> but sideways calls like
> 
>  here.foo.call(this)
> 
> don't have any sugar.

What is the use case for sideways calls? Can you point me to an example? If you 
are after data that is private to a given prototype, consider using an IIFE, 
instead.

There are various interesting ideas in other programming languages when it 
comes to combining methods while overriding:
- Cooperative methods: force overriding methods to call them.
- Before/after/around methods: are invoked before/after/before+after a method 
that they override:
http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node285.html

But that would be overkill for ES.next.

> By the way, I like this idea that "super" is available all the time
> (not just in an initializer) like "this" is always available; however,
> adding another implicit variable "here" which is dynamic like "this"
> is disconcerting as "this" has been quite a wild beast in JavaScript
> to say the least.


I framed things in terms of |here|, because that value can be easily produced, 
as a byproduct of looking for a property. It might also, some day, give us the 
ability to *set* a property that is not at the beginning of a property chain. 
For now, programmers would never directly see |here|, only |super|. |super| 
would be computed on demand, only when someone asks for that value.

-- 
Dr. Axel Rauschmayer

[email protected]
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to