RealyUniqueName / haxe

Haxe - The Cross-Platform Toolkit

Home Page:http://haxe.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Traits

RealyUniqueName opened this issue · comments

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.

Looks like the only option is to define traits as interfaces in externs.