2 ms·
But as I understand, the extension of Class was mainly to introduce a self-binding variant. I assumed that a proper class implementation would take that into ac
by currywurst 13y ago
But as I understand, the extension of Class was mainly to introduce a self-binding variant. I assumed that a proper class implementation would take that into account.
And what is bad about defining the prototype at once? I don't see a great advantage to the defineMethod() style.
- jkrems 13y agoSorry, I was being sarcastic about the `defineMethod`-style. IMHO the author overvalues the class/inheritance part of OOP and discards the considerable risks posed by using it. For example in the case of the self-binding he misuses inheritance to express "a Class with SelfBinding" which is a strategy/trait relationship and inheritance is the absolutely wrong hammer for that screw. A simple function would be less intrusive, have less indirection, and be more flexible. EDIT: I'm not sure self-binding is part of ES6, to address your actual question. self-binding introduces a certain overhead to every function call, so I'm not even sure it would be a good thing if it would.
- currywurst 13y ago:) thanks for clarifying.. And assuming one wants to express the problem in terms of objects, then the slight overhead might be worth being able to pass bound functions around, "without thinking about it"