3 ms·
> Eventually I was able to learn the proper style by watching my code get corrected. Funny thing: I actually benefit from not typing idiomatically! GoSublime r
by vanderZwan 12y ago
> Eventually I was able to learn the proper style by watching my code get corrected.
Funny thing: I actually benefit from not typing idiomatically! GoSublime runs gofmt whenever you save a file. It's a free check for syntax errors, as it won't fix the formatting if you made a mistake. And because the mistake must be in the non-idiomatic formatting, it's easier to spot too.
> I'd love to see a rustfmt, however!
Seriously, I miss gofmt in any language that doesn't have a similar feature. I'm so surprised it hasn't been copied more!
- euyyn 12y agoReminded me of the old Visual Basic, in which you'd declare your variables with caps but write their usage in lowercaps. This way the instantaneous auto-capitalization checked for you that you had written the name correctly (instead of implicitly defining a new variable!).
- ReidZB 12y agoEven today, auto capitalization fixing (and just auto-formatting code as you type in general) is one of my favorite features of Visual Studio, one that I wish I could have in every IDE/editor. For example, if your class is named FooBar and you are declaring a FooBar variable by typing foobar, Visual Studio will just auto-fixit as you type. Same goes for properly formatting if statements, declaring functions required by interfaces, etc... In comparison, Xcode requires you to "confirm" the autocompletion fix by hitting enter, which is less ergonomic in my opinion.
- dorfsmay 12y agoTotally agree. When I started writing python on my own, I dislike some of the PEP8, I liked two spaces, not 4, etc... But then as soon as I started working with teams, my personal preferences no longer mattered, sticking to PEP8 make made life way easier. I think eventually we'll just store the AST in our version control systems, and use interfaces that we will adjust to our preferences when editing, diff'ing etc...