6 ms·
Yeah, it gets really hairy, really quickly. Beyond the need for calling the constructor (which I'm currently viewing it as an unnecessary hidrance [objects are
by Autre 15y ago
Yeah, it gets really hairy, really quickly.
Beyond the need for calling the constructor (which I'm currently viewing it as an unnecessary hidrance [objects are already initialized]), Object.getPrototypeOf may provide a way out - but maybe not the way you intended. Have you considered it?
- Raynos 15y agoObject.getPrototypeOf(Child).constructor.apply(this, arguments); Works, but is even more verbose. However if you use Object.getPrototypeOf on this you fail the recursive problem in nest super calls. Read the stackoverflow euestion
- Autre 15y agoI was deliberately excluding the constructor situation. I should have made that clearer in my previous comment. I think the way out of the constructor mess is not to require them at all. I do think the Object.getPrototypeOf approach is feasible for methods.
- Raynos 15y agothe method fails for the exact same reason. If a single method calls a super method and that method calls another super method then it fails. Object.getPrototypeOf(this).method Always have one value and only one value, calling it more then once leads to infinite recursion.