Re:Your code style guide is crap, but still better than noth...
by pavel_lishin on Friday January 11, 2013 @12:21PM
(#5043692)
I'm a convert to spaces after someone pointed out that it's easier to make your code 'pretty'.
[ Parent
| on HN ]
Re:Your code style guide is crap, but still better than noth...
by JensenDied on Friday January 11, 2013 @12:30PM
(#5043761)
Use tabs to align stuff on the left. This means putting some_key_1 on the next line. Also move the closing brace to a new line and add a comma after some_var_3.
Added advantage that you can move all of the lines around, :sort them or comment out individual ones without breaking anything.
Use spaces to align anything after the key, I usually align them with a tab stop so that several blocks line up.
thing = {
[->]some_key_1: some_var_1,
[->]some_key_2: some_var_2,
[->]some_key_3: some_var_3,
}
Re:Your code style guide is crap, but still better than noth...
by amcgregor on Friday January 11, 2013 @04:46PM
(#5045246)
I use an alternate form that doesn't require alignment to an arbitrary column and works with tab indentation without needing to mix:
thing = {
[→][→]some_key_1: some_var_1,
[→][→]some_key_2: some_var_2,
[→][→]some_key_3: some_var_3,
[→]}
Several benefits: easier to insert lines at the head or tail without making the SCM diff ugly, also avoids merge conflicts in those cases, and I use indentation of two levels to separate it from code.Why suffer a problem when it's easily avoided? :)
Re:Your code style guide is crap, but still better than noth...
by DanBC on Friday January 11, 2013 @12:24PM
(#5043722)
Watch out or you'll get
// I want to beat you with an oar.
thing = {[->]some_key_1: some_var_1,
[->][->][- >]some_key_2: some_var_2,
[->][->][- >]some_key_3: some_var_3 }
Re:Your code style guide is crap, but still better than noth...
by TallGuyShort on Friday January 11, 2013 @12:24PM
(#5043719)
Another tabs-only approach is to also add a single tab before some_key_1.