Open taoeffect opened 2 years ago
StandardJS, being an NPM script, can just be installed globally and run anytime from the command line (or through an extension for your code editor). Does it really need to be "ported" for Deno?
I thought the point was to embrace the newer and better security model of Deno and get rid of the insecure NPM world?
I'd rather see everyone using Deno's formatter and have that enforced by Deno. There's nothing standard about StandardJS whatsoever. As a matter of fact, the de-facto standard in JS is to use semi-colons since that's what the vast majority of JS programmers are already doing.
Semi-colons are unnecessary cruft to uglify your code. There’s no reason for them, they are a relic from older languages.
I disagree that they're cruft when you actually have to remember an extra rule (winky frown) or use a specialized tool in order to safely code without them. Punctuation isn't cruft, it's a necessary fact of life.
The appeal to modernity doesn't really work IMO. Plenty of newer languages released in the past decade have mandatory semicolons, such as Dart from Google.
Punctuation isn't cruft, it's a necessary fact of life.
It really isn't. The JavaScript standard makes them optional for a reason. Semi-colons are not required in many other languages. From a design point of view, there is zero reason for them, either technically, or aesthetically.
I disagree that they're cruft when you actually have to remember an extra rule (winky frown) or use a specialized tool in order to safely code without them.
Programmers always use specialized tools to safely code. They're called compilers, linters, and formatters.
Have you tried using StandardJS for any extended period of time?
From a design point of view, there is zero reason for them, either technically, or aesthetically.
That's not correct. You absolutely need them in a for
statement. You also need them if you want to operate on an anonymous array literal e.g. [1, 2, 3].forEach(i => console.log(i))
, or when you make anonymous function invocations as shown below.
I really wouldn't try using StandardJS for any length of time because the logical reasoning behind it is completely unsound [0]. I feel like that question is designed express the idea that "if you haven't tried it, you just don't know" but I think of it as more like asking me if I've tried holding my breath underwater for over 60 minutes. It's impossible.
Try fixing the forEach
above (it adds a semicolon, and not even on the same line) or better yet, have StandardJS try and fix this code for you automatically:
(function () {
(function () {
console.log('Hello')
})()
(function () {
console.log('World!')
})()
})()
or even just this...
(function () {
console.log('Hello')
})()
(function () {
console.log('World!')
})()
or this
var foo = {
a: "ay",
b: "bee"
}
(function() {
console.log("Hi there");
})();
The online demo errors out and can't fix those at all. You simply cannot remove semicolons from JS without limiting expressivity or changing the language completely!
So, semicolons are indeed a fact of life in JavaScript whether you agree or not and the best thing for a platform like Deno would be to require them at all times. We already know that not everybody will be happy but at least in languages like Golang that enforce their formatting, nobody has to argue with anyone except for the designers and the maintainers.
[0] - The unsoundness of the idea is so evident that I believe the creator of StandardJS named it "Standard" because he knew it actually wasn't the defacto standard for the vast, vast majority of JS devs and he wanted to make it the standard. But, as we all know, if you have to call yourself "The King" - you ain't the king kid. :rofl:
No offense meant to you @taoeffect - I certainly respect your desire for a cleaner looking code!
I've said all that I can say about it and I'm going to leave this thread now. Thanks and good luck to you.
I think, @waynebloss, you completely misunderstood what I was saying. Perhaps it was my fault for using unqualified language.
Of course, in some parts of JS, semi-colons are required. The author of StandardJS is aware of that. As you pointed out, his linter will automatically insert semi-colons where they are required.
Let me clarify what I meant, as I was making two points:
and the best thing for a platform like Deno would be to require them at all times
This is a completely unsupported statement. It's your opinion. In my opinion, that's the worst thing for Deno to do.
Semi-colons aren't needed in programming. They are needed in JavaScript in some specific places, but that is a quirk of the language, which obviously isn't the best when it comes to syntax design. However, a minor improvement to JS code can be made by removing semi-colon usage in most places. It makes the code less ugly and easier to read and write.
This is why I opened this issue. I understand not everyone likes the idea, that's your business. Nobody is forcing you to use StandardJS. You can pepper your code with unnecessary cruft if that's to your liking.
I really wouldn't try using StandardJS for any length of time
This explains your position.
🙏
Semi-colons are driving me crazy!
https://github.com/standard/standard