4 ms·
Why do language designers continue to insist on semi-colon terminated lines?
by TylerE 14y ago
Why do language designers continue to insist on semi-colon terminated lines?
- reinhardt 14y agoPerhaps to dissuade the lowest common denominator of programmers that get hung up on such superficial trivialities.
- TylerE 14y agoBut it's not triviality - it's noise - Signal: Good - Noise: Bad, got it? If you REALLY need end of line markers, any half-way competent text editor can display them for you.
- Kiro 14y agoYou obviously have no idea what signal-to-noise ratio is about if you think semicolons are noise. Who are you trying to impress?
- pekk 14y agoEnd of line is already encoded in source files as \n. Redundancy isn't noise, but it is redundant.
- seanmcdirmid 14y agoIf end of line always means end of statement, by all means get rid of semi colons. If some non-trivial algorithms is used to infer end-of-statement boundaries that is more complicated than detecting end-of-line, then...there will be subtle problems. I went through this transition before in Scala, the error messages got a lot worse after semi-colon inference was added. I wound up telling people to add semi-colons to their code when they were scratching their head at some sort of parse/type error message.
- andrewflnr 14y agoSemicolons are distracting, both reading and writing, and mostly useless. If it's not "noise" in a technical sense, is it not still a bad thing? I don't think this should be a complicated question.
- stcredzero 14y agoIt all depends on what you define as signal and what you define as noise.
- munificent 14y agoIt's simpler to parse and some programmers prefer them.
- Someone 14y agoAnd simpler to parse has another benefit Given an effort X spent writing the parser, users of the language get better error messages Also, I do not think of those semicolons as noise They make text easier to parse for humans, too That's why you see most people end sentences, paragraphs and HN posts with a 'superfluous' period EDIT: Some people will find the above quite readable I am somewhat in that camp Problem is, however, that in English and other languages capitals like I and E are not guaranteed to be sentence starters That muddles the waters considerably Many programming languages have worse problems.
- bonch 14y agoIt simplifies the parser and can resolve syntax ambiguities.
- deleted 14y ago[deleted]
- Yttrill 14y agoTwo choices dictate a terminator: (a) free form 1D language like C vs 2D language like Python or Haskell, and, (b) support for assignment statements x = y and the like as in C vs all statements starting with a keyword as in say ATS. I personally do not like the semi-colons either.
- TylerE 14y agoDoesn't even need to be 2D Layout. See, for instance, ruby.