Is there any way to express an "intersection" type, analogous to a
union type? I can see there may be fewer use cases that there are for
union types, but they could be useful in the following cases:
1. An argument must implement two interfaces, but it's not practical
to introduce a 3rd interface to unify them as a single type.
2. An argument must be some subtype of a given type, but also
implement one or more additional interfaces.
A trivial example (using dubious syntax):
function replicateObject(obj:(DisplayObject & IClonable)):void
{
var copy:DisplayObject = obj.clone();
parent.addChild(copy);
}
I know that proposals are closed now, but this seems simpler than -
and complimentary to - union types.
Peter
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss