COMMUNITY

Import wildcard

Hej !

Is there a way to do a “super wilcard” in import statements ?

I mean If I have db.User.UserType, and I want to import all db.* classes and their subtypes I can’t.
I have to do first import db.* to import all my db entities and then always do import db.User (or db.User.UserType) in order to add my subtype.
Its there a way to tell the compiler to add all including subtypes please ?

Nope, unfortunately wildcard imports work only for primary types or statics.

Thanks Dan for your answer.
Is there any chance this behaviour change one day or it will definitely remain like that ?

Intuitively I would also expect it to look into package modules, so this might be something up for discussion, try opening a GitHub issue. Though implementation-wise it might be a bit tricky and that has to be considered to decide if it’s worth it.

1 Like

If we change the current behaviour it is breaking.

How about : import pack.** ?

3 Likes

Hej Kevin !

Could we know if something like that could be done without doing a big Haxe Proposal thing please ?