Is it possible to create a function in IE >= 9 with null as its prototype? (like in the code below, which unfortunately, works only in Chrome, FF, and Safari)
var F = function(){};
F.__proto__ = Object.create(null);
No, it's impossible without reassigning a [[prototype]] to a function object. IE does neither support the nonstandard __proto__ property nor the ES6 method Object.setPrototypeOf.
The only custom callable objects are functions which you create with function expressions/declarations or the Function constructor. However, all of these methods will create function objects which have their [[prototype]] set to the builtin Function.prototype object.
F will be used as a constructor (in a compiled to javascript language). But the code is going to be more complex. The core idea is that there will be one more line
F.prototype = Fafter that, so all objects created from F will see the attributes of their class; i.e.f = new F(); F.foo = 123; print(f.foo);
Don't do that. While F is a (constructor) function, your instances are not, so there's no reason to let them inherit from it. Just comile your class attributes to F.prototype.foo = 123;. Or compile any accesses to static properties (where "instances see class attributes") to use the F object instead, so print(F.foo).
F.prototype = F, then instances of new F will be regular JS objects. There is no performance penalty for that, but it gives you more flexible way of working with statics (and makes compiler simpler). What's the real downside?__proto__, yeah, I guess that's the only way. It also looks like Function.prototype is read-only, thus eliminating all possible hacks around it too.__proto__ has landed in IE11: msdn.microsoft.com/en-us/library/ie/br212465(v=vs.94).aspxFunction.prototype. However, F is a function and should inherit from Function.prototype. That means that the instances of F should not inherit from F like you had planned. If you could tell me more about (or link) your compiler, I can explain you how to keep static properties simple.
__proto__Fas a constructor function ?F.prototype = Object.create(null);.F = Object.create(null).applyand.call(and the other properties you don't want to be accessible) on the function object itself. But whatever you do, it's likely that it's still possible to useFunction.prototype.apply.call(F, [arguments]), and after reading the other comments that might not be an issue in your case.