Hacker News new | ask | show | jobs
by mdasen 878 days ago
I'm curious what aspect of the code generation you find clunky. When I used Dart, my issue with the code generation was that it didn't "just happen". With C#, anything that's being generated just happens without any involvement from me and it happens basically instantly. With Dart, I was left running their build_runner manually. Plus common things like json_serializable then require you to add methods to wire up the generated methods (partly because you can't have a factory constructors outside of the class definition, but I don't know why they don't just wire up toJson() as an extension method).

I guess I'm trying to figure out if you just dislike having generated files (where you can see the code) or if you dislike how Dart does it (where it's a bit of a clunky process).

1 comments

It works well enough. It's a bit of a hassle to set up and you have to always run the file watcher and add the `part "blah.g.dart"` imports. I wouldn't say it's held me back but I'd be happier if the language itself was flexible enough to eliminate the need for this. I'd also be defining my own macros if it was easier to do.