1

I know IE doesn't support __proto__, but I'm thinking about functions. new Constructor can only set the hidden __proto__ of the automatically created objects, if a function is returned it's __proto__ is untouched, and ES5's Oject.create can't create a function. How can I set the __proto__ of a function? You may suggest to set properties on Function.prototype, but that's not a clean approach. I also want to avoid directly setting properties on individual functions, because it's neither clean nor memory friendly, after all a new property, even only a reference, could consume at least 4 bytes on 32 platform, whereas __proto__ is mandatory hence worths nothing. Please bear with my stinginess ;) So, does anyone know how to do this without resorting to __proto__? Thanks in advance!

--->8---

Edit:

My intention is to use arguments.callees as normal objects, which have methods of their own, and I think it would be groovy if I could put those methods in a prototype.

Need4Steed
  • 2,170
  • 3
  • 22
  • 30
  • So you want a `someFunction`->`myCustomObject`->`Function.prototype`->`Object.prototype`->`null` prototype chain? – Bergi Oct 25 '12 at 15:47
  • `arguments.callee` is deprecated, you should name your functions instead. But yes, it makes no difference if you want to access the inherited props of functions from in- or outside – Bergi Oct 25 '12 at 16:24

0 Answers0