Has anyone ever found a good use for ES2015 object super? eg. ({ foobar() { super.foobar(); }, __proto__: obj, }) I've never seen it used once and feels like an unnecessary addition to the language.
-
Show this thread
-
Replying to @sebmck
it was/could be more useful when there was a way to change/set the HomeObject of a method. It does seem pretty weird tho, still.
2 replies 0 retweets 3 likes -
Replying to @ljharb
Any idea who I could bug to find the rationale, or meeting notes? I’m curious to see the history since I trust there’s a good reason.
1 reply 0 retweets 2 likes -
The rationale for removing “set home object”? There was concern it would be a foot gun. It’s use case was to allow user land creation of class-like abstraction mechanisms that supported `super` but didn’t require use of syntactic `class` declarations.
2 replies 0 retweets 3 likes -
the rationale for super in objects at all, i think was the question
1 reply 0 retweets 2 likes -
Super is a classic OO language feature that enables a subclass to enhance an inherited method typically by adding before/after behavior. EG: class sub extends base { m() { // before super.m(); // after } }
1 reply 0 retweets 2 likes -
I think the question was specifically about object literals, not classes. But, then, I guess the answer is the same, just for people who prefer object inheritance to class inheritance?
1 reply 0 retweets 2 likes -
Exactly.
3 replies 0 retweets 1 like
Thank you Allen for the confirmation and reply! I really appreciate it.
I see that @WebReflection has started replying to this thread in a negative way (despite being blocked) so I'm not going to engage any further.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 