Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up“No semicolons” is the opposite of practical #78
Comments
This comment has been minimized.
This comment has been minimized.
|
If semicolons are your thing, take a look at |
This comment has been minimized.
This comment has been minimized.
|
Duplicate of #5 ? |
This comment has been minimized.
This comment has been minimized.
|
There are just as many if not more arbitrary rules when using semicolons. On Tuesday, March 24, 2015, Daniel Cousens notifications@github.com wrote:
Sent from my phone |
This comment has been minimized.
This comment has been minimized.
callumacrae
commented
Mar 24, 2015
Such as? What does "Always put semicolons between statements." not cover? |
This comment has been minimized.
This comment has been minimized.
I don't think so. Can you name one? |
This comment has been minimized.
This comment has been minimized.
|
For example, you have to remember to not do this:
But remember to use them here:
If you don't like standard, by all means don't use it. Those of us that do use it don't want to argue about semicolons. it's a waste of time |
This comment has been minimized.
This comment has been minimized.
callumacrae
commented
Mar 24, 2015
|
Well, only one of them is a statement (you're talking about function declarations, right?). "Always put semicolons between statements." still works for that. You can't call a coding style "standard" and then suggest that the majority of people don't use it. That's how you hurt beginners. EDIT: Yeah, 85% of DailyJS survey respondents said they use semi-colons. This "standard" isn't standard at all. |
This comment has been minimized.
This comment has been minimized.
There's nothing arbitrary about it. |
This comment has been minimized.
This comment has been minimized.
|
I think we can all agree that the JS syntax isn't the cleanest, if it was we wouldn't have need for a style guide in the first place. That said, if your goal is to change |
This comment has been minimized.
This comment has been minimized.
callumacrae
commented
Mar 24, 2015
|
My problem with this style guide is the name, not the lack of semicolons. Of course you're free to create a style guide that bans semi-colons! What I have a problem with is calling a library "standard" and then requiring something that the majority of developers disagree with. That is not a standard. This is harmful to beginners, and I have seen this affect people in real life. Of course people are going to choose the style guide called "standard". It's just a shame that it isn't. |
This comment has been minimized.
This comment has been minimized.
callumacrae
commented
Mar 24, 2015
|
What I would propose, as a compromise:
|
This comment has been minimized.
This comment has been minimized.
|
@callumacrae The first rule of standard is:
|
This comment has been minimized.
This comment has been minimized.
callumacrae
commented
Mar 24, 2015
|
Then the name should be changed. It's misleading to call something standard if it isn't. You get a little bit of leeway, but when 85% of developers do it a different way, that definitely isn't standard. |
This comment has been minimized.
This comment has been minimized.
Exactly. It's claiming to be something it's not. It's obviously doing this intentional, with all the badges and marketing messages in README. It's actively misleading. |
This comment has been minimized.
This comment has been minimized.
|
@callumacrae @gaearon if you don't like it, don't use it. You energy is being wasted here. @feross' repos aren't governed by a democratic process. |
This comment has been minimized.
This comment has been minimized.
callumacrae
commented
Mar 24, 2015
|
You don't care that this is going to harm beginners? |
This comment has been minimized.
This comment has been minimized.
|
@callumacrae That's your opinion. You have shared it multiple times. Thank you for sharing. |
This comment has been minimized.
This comment has been minimized.
pbrinkmeier
commented
Mar 24, 2015
|
Guys I know this is the internet but |
This comment has been minimized.
This comment has been minimized.
|
Also this is a contrived example:
I'm taking it out of the readme, there is no excuse to start lines with [ or (. It's only useful when writing overly terse/clever code. |
This comment has been minimized.
This comment has been minimized.
|
Thanks everyone for their valuable feedback. Closing this as we have proven that practicality is in the eye of the beholder. |
maxogden
closed this
Mar 24, 2015
This comment has been minimized.
This comment has been minimized.
Have you read the example in my post? It's ES6 destructuring. [a, b] = c; |
This comment has been minimized.
This comment has been minimized.
|
Anyway, I see now that |
This comment has been minimized.
This comment has been minimized.
jlongster
commented
Mar 24, 2015
|
Why... why do you all choose to ignore a fundamental feature of ES6 which many people are using today? |
This comment has been minimized.
This comment has been minimized.
Fishrock123
commented
Mar 24, 2015
|
The better question would be, does destructuring: noSemicolon()
[a, b] = c // destructuringhave the same drawbacks as: noSemicolon()
[a, b] // actual arrayThe second will be interpreted as a single line, ala |
This comment has been minimized.
This comment has been minimized.
KidkArolis
commented
Mar 24, 2015
|
@gaearon @jlongster a serious question - do you actually ever do |
This comment has been minimized.
This comment has been minimized.
callumacrae
commented
Mar 24, 2015
|
|
This comment has been minimized.
This comment has been minimized.
jlongster
commented
Mar 24, 2015
|
@Fishrock123 just tested it, and this works: var z = 5
var y = z
[ x ] = [5]
console.log(x)However, this still breaks: function foo() {}
foo()
[ x ] = [5]
console.log(x)
/*
Exception: TypeError: foo(...) is undefined
*/I'm sorry, I just think you all are introducing a lot more subtle bugs here. |
This comment has been minimized.
This comment has been minimized.
caspervonb
commented
Mar 24, 2015
|
When you pick a package name like standard, and marketing it as the standard style, with it showing up as first rank on Google on at least a couple of queries. It's actually really harmful to be promoting pre assembled footshotguns.. no? Most readers will probably just read the readme and walk away with that knowledge that this is the standard way of doing things. |
This comment has been minimized.
This comment has been minimized.
|
Good point. I don't use this form because I I understand this tool catches this error, but this project is clearly more than a tool. It markets itself as a standard: Experienced JS developers won't fall for this (there's nothing standard about no-semicolons, which is precisely why insisting on them always creates controversy). But beginners may think “standard” (without any capitalization or emphasis in your marketing texts) is indeed the universally agreed “community convention” (from your README), which it isn't. Beginners might then adopt your conventions without using your tool. Which brings them to subtle bugs. For what? Bottom line, it's not nice to call something standard if it's not. Especially when “standard” looks like an objective description and not a name, which it really is: |
This comment has been minimized.
This comment has been minimized.
jlongster
commented
Mar 24, 2015
|
Yeah, you all need to double-check your own preferences. This is clearly a case where you are pushing your own preferences and labeling it the standard within the JS community, which it is clearly not. The majority of the JS world uses semicolons, so if you really are wanting to make a tool for the community, you would forgo your own personal preferences in lieu of the community's. |
This comment has been minimized.
This comment has been minimized.
jamiebuilds
commented
Mar 24, 2015
So not a standard? Okay. |
This comment has been minimized.
This comment has been minimized.
|
To clarify, I don't expect any kind of democratic process around that. I'd say there are several possible options.
|
This comment has been minimized.
This comment has been minimized.
Fishrock123
commented
Mar 24, 2015
|
@jlongster Right, because it still sees it as However, this still works: function foo() {}
foo()
var [ x ] = [5]I'd suspect this would be the more common case, though that might not be true. To me, (This is under my thinking I'll usually just define the variables where I define them, ala |
This comment has been minimized.
This comment has been minimized.
KidkArolis
commented
Mar 24, 2015
|
@jlongster but in this case, |
This comment has been minimized.
This comment has been minimized.
KidkArolis
commented
Mar 24, 2015
|
Ignore my comment - github cache.. |
This comment has been minimized.
This comment has been minimized.
jlongster
commented
Mar 24, 2015
|
as @callumacrae mentioned, it's nice to swap variables with just Also, is this considered starting a line with callFunctionLotsOfArgs(
foo,
bar,
baz,
[ bizzle ]
) |
This comment has been minimized.
This comment has been minimized.
jlongster
commented
Mar 24, 2015
|
For what its worth, I'm sorry for the tone of my recent comments, particularly #78 (comment). Hope you'll forgive me, I'm a little hyped today. We are all part of the same community and I know you all are working hard for everyone else :) |
This comment has been minimized.
This comment has been minimized.
selfawaresoup
commented
Mar 24, 2015
|
Regardless of any semicolons or other specific rules, calling this a "standard" is highly misleading and frankly, a case of hubris. Unless proposed by a governing body (ECMA) a style guide is just that: a guide. Especially, if it's written my mostly just one person. |
This comment has been minimized.
This comment has been minimized.
RReverser
commented
Mar 24, 2015
This! You can't just release something in regard to language that has own organization defining the real standards, and call your thing "standard", even if it's just a coding style. It's not the way standards are created. It's just the same as if I would define own extensions on top of ES5 and call it "ES6 standard" - that would be wrong, misleading and harmful. |
This comment has been minimized.
This comment has been minimized.
freeall
commented
Mar 24, 2015
|
I feel like throwing a "promises or callbacks?" into this discussion. |
This comment has been minimized.
This comment has been minimized.
Fishrock123
commented
Mar 24, 2015
@jlongster Nah, it's only for ones inside code blocks (including global), not as parameters. |
This comment has been minimized.
This comment has been minimized.
|
It only warns you to do that if necessary. The linter can see any Standard is a standard, it may not be yours, but that doesn't matter, as Beginners won't get hurt if they use the tool as specified. Remembering,
|
This comment has been minimized.
This comment has been minimized.
|
Locking due to excessive bikeshedding + haters If you like arguing about semicolons, standard isn't for you. Please take the discussion elsewhere |


gaearon commentedMar 24, 2015
I assume a standard that calls itself “standard” would choose “practical” over “fancy” every time.
It does so, except when it comes to semicolons.
Consider these two rules:
(or[They can be substituted by one simpler rule:
The “never start a line with
(or[” rule is very arbitrary.It is only going to get worse with ES6 where
is a valid destructuring construction.
Isn't it strange to write
{ a, b } = something() ;[a, b] = something()thus making code less uniform, if you can make it more uniform by just writing semicolons?
{ a, b } = something(); [a, b] = something();I understand you probably have feelings about this subject, so I don't really expect this to be considered.
Still, it is unfortunate for the subjective aesthetics to triumph over the objective simplicity in something called a “standard”.