4 ms·
As a matter of personal preference, hoisted curlies drive me insane.
by tempodox 2y ago
As a matter of personal preference, hoisted curlies drive me insane.
- layer8 2y agoWhat are “hoisted curlies”?
- stronglikedan 2y agoIf I had to guess, it's putting the opening curly bracket on the same line as the function definition, instead of the next line. And if I'm correct, then I also agree.
- patrickmay 2y agoAllman style FTW!
- tempodox 2y agoif (condition) { // <- hoisted curly do_it(); }
- adrian_b 2y agoObviously the personal preferences about code formatting vary a lot among programmers and it is impossible to reach unanimity. For instance, I am among those who are annoyed when seeing lines of text wasted with the opening curly brace, reducing thus the number of useful text lines visible on the screen. Probably it is best to use an automatic code formatter and format the code according to personal preferences while working with it and then reformat it according to project rules when committing the code to the repository.
- mindcrime 2y ago> For instance, I am among those who are annoyed when seeing lines of text wasted with the opening curly brace, Conversely, I'm one of the people who are annoyed when the tokens that represent a block of code don't form a vertical line, making it much harder to see "at a glance" where blocks begin and end. > Probably it is best to use an automatic code formatter and format the code according to personal preferences while working with it and then reformat it according to project rules when committing the code to the repository. At the end of the day, I'm convinced there is no "right" way to do this. Everybody has their preferences, and who's to say that one set of preferences is objectively more meaningful than another? You care about wasted vertical space, I don't. I care about tokens lining up, you (probably?) don't (at least not as much as I do). But neither of us is really "right" or "wrong".
- bombela 2y agoAnd I am annoyed with the lack of indentation with a dedicated character (like tab maybe). With spaces, my editor has to guess how much to delete. If I want to tabulate a table. It might fight me. This really irks me. I want it all. No lines wasted, uniform indentation, dedicated indentation character. Python with tab for indentation feels right to me. I also like to set a vertical highlight in my editor to vertically delinate indentation levels.
- lmm 2y agoThe best available evidence is that bug count correlates only with number of lines of code, and therefore an approach that reduces the number of lines of code is objectively better. Some people don't like Whitney-style code, but as far as I can see that's just intellectual cowardice.