Abstract type generics

I am confused by Multitype and constraints, mixed with generics, and fustrated that there is nothing like a compile time interface of abstract types
I am trying to allow a virtual bitmap cpu processing library to use a range of data structures. So currently the code works with UInt32Array and does some nice stuff slowly, like Barycentic triangle texture distortion, svg path drawing, thin lines, filters…
So @:Multitypes may be more of an internal tool, I am not really sure how to wire it up.
Essentially I would like to abstract around multiple abstracts of datastructures via a common interface;

Now multitype from my basic understanding at a basic level seems to infer only the first ‘to’ and the compiler is not able to use alternate methods for each data structure?

import haxe.ds.Vector;
// entry point
function main() {
    trace("Haxe is great!");
}
typedef TFoo = {
  public var name: String;
  @:arrayAccess public function set(index:Int, value:Int):Int;
	@:arrayAccess public function get(index:Int):Int;
}
interface IFoo{
  public var name: String;
  @:arrayAccess public function set(index:Int, value:Int):Int;
	@:arrayAccess public function get(index:Int):Int;
}
@:generic
@:structInit
class Foo<T> {
    public var name: String;
    public var data: T;
		public function new( name: String, data:T ){
      this.name = name;
			this.data = data;
		}
}
abstract class AFoo<T> extends Foo<T> implements IFoo {
	@:arrayAccess
	abstract public function set(index:Int, value:Int):UInt;
	@:arrayAccess
	abstract public function get(index:Int):Int;
} 
@:structtInit
class ArrayFoo {
	public var name: String = 'array foo';
  public var data: Array<Int>;
  public function new( name: String, data: Array<Int> ){
		this.name = name;
    this.data = data;
  }
}
@:structInit
class VectorFoo {
	public var name: String = 'vector foo';
  public var data: Vector<Int>;
  public function new( name: String, data: Vector<Int> ){
		this.name = name;
    this.data = data;
  }
}
abstract VirtArrayFoo( ArrayFoo ){
  public inline function new( name: String, len:Int){
		this = new ArrayFoo( name, new Array<Int>() );
    for( i in 0...len ){
			this.data.push( 0 );
    }
  }
}
abstract VirtVectorFoo( VectorFoo ){
  public inline function new( name: String, len: Int ){
		this = new VectorFoo( name, new Vector(len) );
  }
}

@:multiType(T)
abstract MultiFoo<T>( AFoo<T> ){
	public function new(value:T);  
  @:to static function ofVertVectorFoo(_:IFoo, name:String, len:Int ):VirtVectorFoo {
		return new VirtVectorFoo(name,len);
	}
  @:to static function ofVertArrayFoo(_:IFoo, name:String, len:Int ):VirtArrayFoo {
		return new VirtArrayFoo(name,len);
	}
}

I know simn is not keen on us using multitype, but not sure of the alternatives, currently it is quite hard to abstract type over multiple api’s in the way I am trying, and there is nothing like an abstract type interface. Many times when I try to use generic to the nth degree - Haxe seems to have aspect like generics but they are really hard to fully use with complex abstract cases especially if they are virtual constructs rather than traditional pure classes. Also seeing a lot of inconsistany around this area with targets… HL is lightly impossible and JS is very easy but perhaps too sloppy occasionally.

Here’s a nice tutorial on using abstract multitypes.

already read tutorial, but I have just tried building slowly up towards my usecase and I think there is a feature/bug in haxe, which prevents my use?

It is like the type system gets lost but if simpler it is ok