Hacker News new | past | comments | ask | show | jobs | submit login

I have really liked dart, and started playing with it when it came out. I just wish I could use it more. Unfortunately it and its tools are so opinionated its kind of hard to use outside of the specific cases they have dreamed of. I really wish there were opt outs, even if it broke things that would be worth it.



Which of its tools are opinionated and how? Do you mean the formatter, perhaps?


The 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.


This 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.


That 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: