> Things have progressed since then but this still seemed fresh and I > thought worth sharing -- hope it's ok to cite, wasn't really meant to > be narrowcast back in the day (my fault probably).
It's fine, but thankfully we have fixed all the above points in the fe and pp layers -- we preserve literals and comments verbatim through pretty printing -- aside from a few corner cases where comments get extra spaces stuck in around them. The current source code has been pretty-printed multiple times and we have a small (but ever-expandable) portion of the testsuite dedicated to testing pretty printing round trips. For "enforcement" I'm still in favour of telling users they can easily pretty print, but accepting ugly-format stuff during parsing. For the following reasons: - The pp algorithm is complex enough that we can't tell, during parsing, exactly where a wrap would occur. We'd have to pp each source unit in-memory after parsing and do a memcmp to see if you and the pp agree. This would slow things down a fair bit. - The pp algorithm isn't the world's most stable thing anyways. It was chosen from a lot of existing ones based on producing average-good looks in most cases, but it's an ancient and imperative algorithm and I don't really want to be breaking users any time we tweak it. - Wrap-width is something I expect people will always disagree over, depending on the sizes of their terminals and monitors, and I think forcing it will just make users angry. -Graydon _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
