News for hackers. Stuff that matters.
Re:Things Rust shipped without by pcwalton on Friday July 03, 2015 @03:14PM (#9827418)
This is the first I've heard complaints that Rust is too strict with formatting. If anything, the popularity of gofmt (which is far more opinionated than rustc's default warnings are!) is a testament to the fact that people want languages to be ruthlessly opinionated regarding style these days.
Re:Things Rust shipped without by madez on Friday July 03, 2015 @03:38PM (#9827548)
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.

Re:Things Rust shipped without by tatterdemalion on Friday July 03, 2015 @03:43PM (#9827572)
rustfmt (currently in development) follows this principle.
Re:Things Rust shipped without by Animats on Friday July 03, 2015 @03:56PM (#9827614)
Please 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.
Re:Things Rust shipped without by tatterdemalion on Friday July 03, 2015 @05:34PM (#9828084)
I'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.

Re:Things Rust shipped without by madez on Friday July 03, 2015 @04:17PM (#9827712)
It 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.

Re:Things Rust shipped without by andresmanz on Friday July 03, 2015 @03:20PM (#9827459)
That's absolutely OK and I do understand that people want that. I actually like snake case and only slightly prefer camel case. I'd write snake case in large open source projects, if it's actually preferred. But it's very awful to type snake case code on my keyboard and I'm not ready yet to switch to a US keyboard. The worst thing about that warning is that I get some kind of a bad conscience by disabling it.
Re:Things Rust shipped without by shawkinaw on Friday July 03, 2015 @03:34PM (#9827531)
Even on a US keyboard snake case is annoying to type (for me at least.)
Re:Things Rust shipped without by nightpool on Friday July 03, 2015 @03:33PM (#9827530)
have you thought about binding underscores to some other key combination at the operating system level?
Re:Things Rust shipped without by cpeterso on Saturday July 04, 2015 @01:31AM (#9829349)
SHIFT+SPACE could be a good keyboard shortcut for underscore because snake_case's underscores represent spaces between words.
Re:Things Rust shipped without by nightpool on Wednesday July 08, 2015 @01:52PM (#9853439)
Oooh, I hadn't thought about this. I might want to try this even on my (US) keyboard!
Re:Things Rust shipped without by dragonwriter on Friday July 03, 2015 @06:02PM (#9828175)
> If anything, the popularity of gofmt (which is far more opinionated than rustc's default warnings are!) is a testament to the fact that people want languages to be ruthlessly opinionated regarding style these days.

Its testament to the fact that there are some people that want that; that's very different from that being what people in general want.

Re:Things Rust shipped without by jpgvm on Friday July 03, 2015 @03:21PM (#9827468)
I'm in the camp that would love for rustfmt to become both very strict/opinionated and widely used.

It makes everything so much easier to read.