4 ms·
Which of its tools are opinionated and how? Do you mean the formatter, perhaps?
by markdog12 3y ago
Which of its tools are opinionated and how? Do you mean the formatter, perhaps?
- lbhdc 3y agoThe one I hate the most is file structure. In order for something to be a "package" it has be be in a `/lib` dir or some other magic name. I wanna nest modules and flatten their structure. If there were a flag to disable this, even if it meant I couldn't use any published third party lib or publish any packages, I would have many many new dart projects. I could probably extend my dislike of this to the entire import system. There are so many aspects of it that I dislike.
- brabel 3y agoThis is one of the weirdest complaints I've ever heard. Almost every language has some sort of requirement for where you put files to properly compose a library. Dart is one of the sanest I know of, just throw your stuff in `lib/mylib.dart`. This file is normally only used to `export` what your lib API should look like, and it's a convention that the implementations go in `lib/src/`. That's all there is! You can break up files apart any way you want from there. To import a file from another file you do `import 'relative/path/to/file.dart`. Dart doesn't care where your imported files are as long as it can find them. There's no "packages" like in Java, but that's never a problem because imports can be named. So you do stuff like: import 'mylib.dart' as mylib; // call mylib function main() => mylib.foo(); So simple, so great... I really can't understand why someone would complain about such an elegant system.
- lbhdc 3y agoThat is fair, there are more ways to import than you mention. Dart has a lot more constraints than a language like go or python. I use both in places I would like to use dart. I have looked at forking the language to explore an alternate system, but the path of least resistance has been using other languages.