Reputation: 2146
Is it possible to make a class called Map:
// src/test/Map.hx
package test;
class Map {
public function new ( a : Int, b : Int : c : Int ) {
trace( a + b + c );
}
}
And then somehow access both this new Map
class AND the original Haxe Map construct in Foo.hx?
// src/test/Foo.hx
package test;
class Foo {
var map1 : test.Map = new test.Map( 1, 2, 3 );
var map2 : Map<Int, String> = [ 0 => "Hello" ];
}
This doesn't work, because the map2
type is automatically resolving to test.Map
(not the Haxe one) because Foo.hx is part of the test
package which contains the new Map
class.
If the Haxe Map
construct was part of a package, this would be easy (could just say package_name.Map
). However, it has no package. So is there no way to access both?
Upvotes: 4
Views: 78
Reputation: 1847
With Haxe 4 you will be able to use haxe.ds.Map
.
Meanwhile, you should be able to access haxe's Map
with std.Map
.
Upvotes: 6