As far as I understand, in JavaScript (Gecko variant) this:
var a = new A();
is a syntactic sugar for something like this:
var a = {};
a.__proto__ = A.prototype;
A.call(a);
Because of that, A() (which is equivalent to A.call()?) and new A() should produce two different results, like these:
>>> new Date()
Fri Nov 19 2010 01:44:22 GMT+0100 (CET) {}
>>> typeof new Date()
"object"
>>> Date()
"Fri Nov 19 2010 01:44:42 GMT+0100 (CET)"
>>> typeof Date()
"string"
So far so good.
But, core object Function
behaves differently:
>>> Function('return 123;')
anonymous()
>>> typeof Function('return 123;')
"function"
>>> Function('return 123;')()
123
>>> new Function('return 123;')
anonymous()
>>> typeof new Function('return 123;')
"function"
>>> new Function('return 123;')()
123
Am I missing some trivial thing here ?