Traits
RealyUniqueName opened this issue · comments
Aleksandr Kuzmenko commented
Since PHP has traits we need an ability to specify that an extern class extends multiple classes so that compiller won't complain in such cases:
var q = new ExternClassUsingTrait1AndTrait2();
fn1 (q); //q is of type Trait1
fn2 (q); //but it is also Trait2
function fn1 (a:Trait1) {...}
function fn2 (a:Trait2) {...}
Perhaps in externs traits should be represented as interfaces.
Note: class can have two traits with the same method name, but different signature.
Aleksandr Kuzmenko commented
Looks like the only option is to define traits as interfaces in externs.