Function Constructors as a type?

Brendan Eich brendan at
Tue Jun 26 14:01:06 PDT 2007

Functions are objects (instances), not types. Any new F given  
function F(){} must return an Object, as in ES1-3.

You can write function types of course, they are structural types:

type F = function (int, double, string):Object;

The usual subtyping rules apply, with sane extensions for optional  
and rest parameters. An update to spec/type_system.html is coming  
soon, and look for spec/type_relations.html too (under http://


On Jun 26, 2007, at 1:51 PM, Kris Zyp wrote:

> Is it possible to use a function constructor as a type? For example:
> function F() {}
> var f : F = new F;
> I assume this is not allowed, although I would think it would be  
> nice if it were allowed, but I can't seem to find anywhere in the  
> spec where this is explicitly stated and t he current reference  
> implementation goes into an infinite loop when this is executing, I  
> assume that is not the intended behavior :).
> Kris
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Es4-discuss mailing list