Description
Hello,
I just want to put in my two cents on the issue and document this concerns about code imports in Dart.
I don't expect anyone to take it seriously. I totally understand the issue has the lowest priority and I apologise for any inconvenience caused.
Designing imports system makes sense to take in account Java. The language has a very powerful imports management with a very simple and reliable syntax.
Example:
import com.company.libraby.package.Class;
- That namespace is wider than the intended language. Import refers to concept in a knowledge domain, not to a specific class. Since no files are mentioned in the import the naming works outside Java language.
- Import syntax has no references to a project name (in contrary to the Dart). Client code doesn't know and doesn't care about the source if the import. The client delegates the responsibility of providing its dependencies to external system like IDE or a runtime environment.
- Name conflicts are resolved using explicit import. If you have a class that refers to the
Map
interface and some other geographicalMap
, you can call classes with their full names likecom.java.util.Map
andorg.geography.Map
. No need obscuring your code withimport A as B
-type statements.
Here I documented some of the most obvious import refactoring problems I encountered (let me know if you have any workarounds.):
#30294
#30295
#30296
#30297
#30298
All of the mentioned problems are nicely solved in Eclipse IDE for Java developers. So there is proven track record of success for the naming convention.
Key points of it's success:
- All public classes are exported by default. No need the
export
operator. - When you move classes between projects you no need to do refactoring at all. (solves Moving code from one package to another doesn't update dependencies #30298)
- IDE takes the job of automatic imports resolution (helps to solve Missing import suggestions #30295 Imports refactoring: changing import folder fails to update dependent classes #30294 Optimize imports command doesn't resolve imports automatically #30296 Dependent project can't see ext imports to make suggestions #30297)
Thank you for your attention to this matter.