3 ms·
No thanks. With the full markup you can see where things end, not just where they start. I think this is similar to semicolons in Javascript: with semicolons a
by timw4mail 4y ago
No thanks. With the full markup you can see where things end, not just where they start.
I think this is similar to semicolons in Javascript: with semicolons at the end of each statement there is no ambiguity, but if you do not have semicolons, you have to know about edge cases, like if a line starts with a square bracket or paren.
- iamben 4y agoAgree 100%. It's also about a thousand times easier for people with a very basic HTML understanding to parse (if you open something, with pretty much the exception of an image, you gotta close it). Periodically I have to send code to people who then make some of their own changes inline. God forbid trying to explain "yeah, they don't need to be closed, but that does because it's nested and..." Disaster (/hours of extra support) waiting to happen.
- mst 4y agoI have a tendency to forget ASI in JS exists when I've only been looking at my own code rather than other people's for a while. I remain unconvinced it was a wise idea.
- lelanthran 4y agoWhat is ASI?
- mikewhy 4y ago"Automatic semicolon insertion": https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#automatic_semicolon_insertion https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- currysausage 4y agoYou have to know HTML in order to know where things end. Otherwise, you will see nested paragraphs here: <p>Hello <p>World</p>!</p> when it’s actually two consecutive paragraphs, an exclamation mark outside of any paragraph, and a closing p tag without an opening counterpart. And when you do know HTML, you might as well omit optional tags. If you think that HTML syntax is crazy, I won’t blame you, and you might consider XHTML instead, but you should be prepared for different woes.
- exyi 4y agoYou can't disable this "feature", so you still don't know where things end / begin. Some tags can't be nested in <p> while you could expect that they can: <p> Paragraph with a list won't work as you could think <ul> <li> Test </li> </ul> Something else </p> Parses to: <p> Paragraph with a list won't work as you could think </p> <ul> <li> Test </li> </ul> Something else <p></p> Similarly, in JS you are paying the price for optional semicolons even if you decide to use them. return { x: 1 }; Will still not work even if you use semicolons elsewhere. So I don't see any advantage to actually using semicolons. JS is not worse than Python with it's basic inference, and yet in Python people will almost yell at you if you attempt to use a semicolon :) I'd much prefer these features to be opt-in (yea, give me XHTML back for generated content). But when I can't can't disable them, why not embrace them ;)
- Ontonator 4y agoOn the point about semicolons in JavaScript, the logic I’ve heard is that if you consistently use semicolons, you can have a linter warn you if there is an inferred semicolon, so you know if you have made a mistake. If you don’t use semicolons and accidentally produce code with an inferred semicolon that should not be there, then there is no way for any tool to warn you. (Well, no general way; in your example with the return, many linters would warn you about unreachable code.)
- epolanski 4y agoI never use semicolons and I never have these issues. Even in the rarest cases I maybe had them like when copy pasting in the wrong place they were so rare that I don't think it's worth the additional noise of semicolons.
- leonsegal 4y agoThere are 3 major footguns with automatic semicolon insertion iirc (one involves having the return statement on its own line. As long as you know them all it's fine I guess, but not my taste.
- 4y ago