Open utterances-bot opened 3 years ago
according to this:
Haxe allows using a wildcard symbol .* to allow import of all modules in a package, all types in a module, or all static fields in a type. It is important to understand that this kind of import only crosses a single level as we can see in the following example
assume we have a module under mypkg.MyModule.MyModule
, the wildcard import mypkg.MyModule.*
only import all static fields inside the module MyModule
, not "all types in a module"
I think you could just use import mypkg.MyModule;
to import all types in MyModule
?
Even through grammar is similar, It's very different from some common languages like javascript / python / go.
There's some tips (Haxe 4.3):
Not Like Java. A.hx means module A, must be starts with uppercase. This rule and java-style helloword reminds me of Java. I thought it was like java, one Class one File. But IT'S NOT TRUE. In haxe, Module is one thing, and Class is another.
Package is one more distinct thing. If you install lib from haxelib(e.g. haxelib install pkg ), you should import it like than: import pkg.custom_path.ModuleA.ClassB
or import pkg.custom_path.ModuleA
.
import pkg.ModuleA as X
is not allowed. Module alias is not allowed in Haxe.
import pkg.ModuleA.ClassB as B
is ok.
import pkg.ModuleA.funcC as c
is ok.
When you import a module, like "import pkg.ModuleA", equivalent to import * from pkg.ModuleA
in ts.
I can't find a grammer equivalent to import * as ModuleA from pkg.ModuleA
.
I'm 99% sure you can do Module alias, the documentation didn't state if it's allowed or not
Import - Haxe - The Cross-platform Toolkit
Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.
https://haxe.org/manual/type-system-import.html