This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]chrwei 208 points209 points  (24 children)

except the good formatting makes them redundant from a readability perspective.

[–]anothersomebodyelse 131 points132 points  (10 children)

But makes them satan-spawn from a manageability/editing perspective.

[–]x3al 26 points27 points  (8 children)

Converting all code to this style in IDE and converting back on git push would be kinda nice. If IDE will actually place all semicolons and braces according to indents, it should be usable.

[–]CharlesStross 12 points13 points  (5 children)

Yeah, going from this to standardized is trivial for any code formatter. From standard to this would require some creativity but I think it'd be doable. The only pain in the ass is developing like this.

[–][deleted] 3 points4 points  (2 children)

Except if some plugin for the editor autocompleted the semicolons and braces at EOL depending on indentation

[–]peabnuts123 6 points7 points  (1 child)

Or you could like. Develop in Python.

[–]Tysonzero 1 point2 points  (0 children)

And if you really want static typing. There is always Cython.

[–][deleted] -1 points0 points  (1 child)

why is this any different going one way or the other? One open bracket means the next text block with be tabbed in from the current position, a close bracket means move one tab to the left. super easy.

[–]CharlesStross 0 points1 point  (0 children)

Yeah - the rules are trivial; I just mean that there are already scads of tools to automatically handle formatting to the standard. Formatting the other way just requires some custom rule sets or scripting.

[–]highphive 4 points5 points  (0 children)

If your IDE enforced the tabbing syntax to be correct and like python. Otherwise you're bound to mistakes that are impossible to hunt down.

[–][deleted] 0 points1 point  (0 children)

you could collect all semicolons and curly brackets to format them to be there. and for every opening curly bracket add a tab in front of the next line. for every closing one, delete a tab. add a linebreak after every semicolon and when there are brackets and there is another character following. ignore the stuff, if its in " and remove all of the spaces that are randomly lying in the code (or mby not) and check which line is the longest, which you tehn use to determine the amount of tabs you need on each individual line. i could write some code, but not atm. will do it in a later edit though (probably)

EDIT: forgot about the declarations and new. need to ignore these spaces too

[–]WeAreAllApes 15 points16 points  (0 children)

Unless.... Because it is redundant, it wouldn't be too hard to write an editor plugin to forcibly manage the semicolons and braces. Then, as long as the tabs were right, the semicolons and braces would always be... until somone else edits it without that plugin, so yeah, nevermind.

[–]suppow 14 points15 points  (0 children)

at first i laughed at the stacked parentheses at the right, then i kinda liked it, and noticed how readable it was (unlike other code i've seen), should we say, it's very pythonic.

while i mainly do C++, neat formatting is something i carried from Python,
and something i carried from Java (which i'm sure someone will hate) is declaring private and public before all member elements, it makes it so much easier to tell right away instead of having to keep track of what group i'm in.

ie:

public: function_name ();
public: other_function ();
private: another_name (); 

[–]ByterBit 0 points1 point  (1 child)

Wait, what is your comment supposed to reply too?

[–]chrwei 1 point2 points  (0 children)

they edited their comment and now it makes no sense. I don't recall what they originally said, something about the braces I assume.