4 ms·
It's so much better to let the computer worry about formatting such that the programmer can worry about the logic. fmt-tools offer the amazing possibility that
by madez 11y ago
It's so much better to let the computer worry about formatting such that the programmer can worry about the logic.
fmt-tools offer the amazing possibility that one programmer writes and reads the same code with different formatting than another programmer. I'd love to be able to set my formatting in my editor so that I see it how it's best for me but on saving or sharing code the formatting is reverted to the standard.
So, I think there should be a default style for rustfmt, but also support for other styles.
- tatterdemalion 11y agorustfmt (currently in development) follows this principle.
- Animats 11y agoPlease don't make it an option. Use one format to rule them all, as with "gofmt". I don't care what it is, but pick something and standardize.
- madez 11y agoIt seems you are misunderstanding the situation because you are talking about not making “it” an option and you are then reiterating what I also said. Even if I repeat myself: I think there should be one default formatting that is standardized and there should be the option to emit in other formats such that everyone can read in the individually preferred format. With fmt you don't need to establish formatting rules on a project basis, anymore. Everybody can just configure their editor to format the code how they want it to look. That is why I think rustfmt should be compilable as a library, too.
- tatterdemalion 11y agoI'm not working on rustfmt but my understanding is that its output is going to be configurable. Every language carries with it a culture. The culture of Go is one which allows for gofmt to define one true style and refuse to deviate, just as it allows the language designers to refrain from adding generics. The culture of Rust is not like that, for several reasons. For one, the Rust community loves a good bikeshed. For two, the syntax of Rust is more complicated than Go, and includes situations (match statements & where clauses come to mind) in which people are just going to want to different things. I know the advantages of one true style - everyone's heard the arguments - and there's a sane, median default as the official style guide, which will be rustfmt's default output. That seems like a good compromise.