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:// developer.mozilla.org/es4/).

/be

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
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to