3 ms·
I don't understand the attractiveness of "no-semicolon" in the sense of "a statement/expression ends at a line end, except if ...", with some arbitrary rules re
by serichsen 15y ago
I don't understand the attractiveness of "no-semicolon" in the sense of "a statement/expression ends at a line end, except if ...", with some arbitrary rules replacing "...". This seems to be a current trend. Why can't we have simple, unambiguous syntax with no pitfalls in new languages?
I want to point at the start of a statement/expression, ask "where does this end?", and get back a single, general answer, like "at the semicolon" or "at the corresponding closing parenthesis".
That is what punctuation is for. Imagine reading an english text with no punctuation, where the author just made sure to end a line wherever he wanted a sentence to end. Do you really want to stop at each line end and have to answer the question whether it ends the sentence?
- Ralith 15y ago> Why can't we have simple, unambiguous syntax with no pitfalls in new languages? Yeah, s-expressions should be more widely adopted.
- tomp 15y agoMaybe a better solution would be to have a syntax for writing and a different syntax for reading, i.e. the editor would automatically add the semicolons at the line endings where they would be appropriate.
- ismarc 15y ago(this is gonna sound bad, but) I'm a fan of how lines end in sh/bash. If there isn't a matching close for every open symbol, or there's a slash (opposite of /, my phone doesn't have the character on the keyboard) it ends after the next line that doesn't meet these conditions. ; is then a command terminator that separates different commands on the same line. I like it because it's explicit, easy to see visually and doesn't require special understanding of the semantics of the language to know if the line can be split there, only understanding of the line endings. It also allows folks to explicitly include the line endings if they want.
- dchest 15y agoImagine reading an english text with no punctuation I don't think this is a good analogy considering that each statement usually go on a separate line. Punctuation is helpful if there are multiple statements on the same line, but finishing each statement with semicolon and new line just adds noise.