'Bob Nystrom' via Dart Misc
2015-09-09 22:09:22 UTC
Now that more of you are running dartfmt, I get a lot of questions about
how it works its magic. There are actually two related questions here:
1. What is the set of formatting rules and constraints it is trying to
apply? In other words, what is its mental model of the style guide?
2. How are those rules implemented and solved efficiently?
I should really write down answers both questions. The former is probably
the more relevant one, and the shorter one to answer. Somehow, I ended up
writing the latter first.
If you'd like a very detailed walkthrough of how the formatter works
internally, I wrote a long blog post about it here
<http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/>.
You could also just read the source (which I am ashamed to admit may be
shorter than the blog post), but what's the fun in that?
Cheers!
- bob
how it works its magic. There are actually two related questions here:
1. What is the set of formatting rules and constraints it is trying to
apply? In other words, what is its mental model of the style guide?
2. How are those rules implemented and solved efficiently?
I should really write down answers both questions. The former is probably
the more relevant one, and the shorter one to answer. Somehow, I ended up
writing the latter first.
If you'd like a very detailed walkthrough of how the formatter works
internally, I wrote a long blog post about it here
<http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/>.
You could also just read the source (which I am ashamed to admit may be
shorter than the blog post), but what's the fun in that?
Cheers!
- bob
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.