Earlier quoted context omitted.
It's surprising that we haven't managed to create languages/editors which can break code down into atoms which can be presented however the developer working on said code likes. E.g. if a segment of code was tokenized properly and the editor could manipulate those tokens, coding style issues would become a thing of the past.
If you can express your style in a way a code-formatting tool can apply, then you can use checkout and commit hooks in your vcs to apply the formatting. Code in the repo gets a team-standard formatting, and code in your working copy gets your personal formatting. You just have to make sure the whole team uses the commit hook, at least. (Or in most systems you can apply that hook on your central/official repo.) The on…
Best Practices Exist For A Reason
101–105 of 105 posts
Re: Best Practices Exist For A Reason
#102Earlier quoted context omitted.
"Between semicolon-free folks and JavaScript traditionalists, who gets to play the role of the expert?" You're framing this as a disagreement between equals. It is not. There are degrees of expertise. (Total lines of production code * amount of usage) is a reasonable approximation, and those who rank highest on this scale are overwhelmingly in favor of requiring semicolons. If Carmack and Torvalds were in agreement o…
Brendan Eich does not oppose ASI. Error correction simply means "add a semicolon if it's necessary."
He says it should be thought of as an error correction feature.
That is: do not in any case rely on ASI. Add your semicolons and only let ASI do it works when you do an actual ERROR and forget to add one.
Re: Best Practices Exist For A Reason
#103Earlier quoted context omitted.
That example gist went a long way towards convincing me of isaacs' comma prefix style. To me, consistency is important. All of my codebase is traditional comma postfix, so I'll keep using that; however, maybe with some new projects I'll try on the comma prefix pants and see if it helps. Thanks for the link!
To play at devil's advocate, please don't. Otherwise you should have written your comment like this: To me , consistency is important . All of my codebase is traditional comma postfix , so I'll keep using that ; however , maybe with some new projects I'll try on the comma prefix [...] ... using typography in a typographically sensible way is far more important to readability than an arbitrary "consistency" of punctat…
To me, consistency is important
. All of my codebase is traditional comma postfix
, so I'll keep using that; however
, maybe [...]
Which is more confusing than either of our consistent examples. Unless I misunderstood your point.Re: Best Practices Exist For A Reason
#104Earlier quoted context omitted.
In general I agree completely, standard philosophy of science stuff. I'm not sure how well it applies to a subject like best practices where it's either subjective or at least fuzzy. The arguments are "in my experience this causes problems when working with other people and is more prone to errors long term". There have been no counter examples or analysis I've seen around this issue, just a "that's just what the tra…
The reason for using semicolons in JS is quite simple: It makes it easy to determine the boundaries between statements, both for humans and machines. With semicolons, the search for the boundary between statements reduces to the search for that single character -- that means fast code skimming. The boundary is also robust against changes; as long as that semicolon stays in place, nothing that happens within that stat…
Re: Best Practices Exist For A Reason
#105Earlier quoted context omitted.
The reason for using semicolons in JS is quite simple: It makes it easy to determine the boundaries between statements, both for humans and machines. With semicolons, the search for the boundary between statements reduces to the search for that single character -- that means fast code skimming. The boundary is also robust against changes; as long as that semicolon stays in place, nothing that happens within that stat…
We're so off track that it's been lost that all my points are very definitely pro-semicolon?