6 ms·
Do not know why this old page is revived again, but a better title would be "So you want to write you C or C++ like own language?". Among other points is the t
by scriptproof 11y ago
Do not know why this old page is revived again, but a better title would be "So you want to write you C or C++ like own language?".
Among other points is the trailing semicolon. If this is so good, then the authors of Go and Swift must be wrong.
- Randgalt 11y agoI don't think you can say one is objectively right or wrong. However, as someone who's programmed for nearly 40 years, the entire issue seems like a fetish. Would anyone choose a language solely based on whether separators were required or not? Is your productivity dramatically increased by the choice of required separators? Of course not. In functional languages there are some reasonable needs that make not requiring a separator useful. But, it does make the code harder to parse and harder to read. Go, for instance, is not a functional language. Making separators optional (sometimes) seems capricious. But, then, Go is rife with capricious choices.
- astrobe_ 11y ago> Would anyone choose a language solely based on whether separators were required or not? Is your productivity dramatically increased by the choice of required separators? Of course not. It may if you have to switch between languages. Getting syntax errors because of dummy separators can be quite frustrating at times. So the choice is mandatory separator or optional separators. I designed a language once in which most punctuation characters where treated as blanks.
- Randgalt 11y agoEvery day I write in bash, Javascript, XML, JSON, Java, Scala and probably a few others. Trivial differences don't matter.
- jerf 11y agoGo uses semi-colon insertion like Javascript does, albeit with the benefit of Javascript's experience to fix up the edges. Calling "adopting some of the syntax of arguably the most popular language" capricious is probably stretching a bit.
- imtringued 11y agoI don't see why anyone would even think that a band-aid solution like "automatic semi-colon insertion" is a good idea. If you want optional semi-colons you have to change your language's syntax.
- restalis 11y agoJavascript's popularity have nothing to do with its value as a language, considering that it didn't have any competition in what it does. Ignoring the (almost already) decades of critique addressed to its design choices and quirks to declare it a cherished wonder is _no doubt_ a stretch.
- vdaniuk 11y ago>Is your productivity dramatically increased by the choice of required separators? Of course not. Yes, for me it does. A large amount of symbols on screen makes my mind drift away and it gets harder to concentrate on the flow and meaning of code. Semicolons or lisp parens are good examples of such visual noise. While productivity decrease is not drastic, it's noticeable. The mind adjusts and this problem diminishes with time and practice of the particular syntax but it's still present.
- k__ 11y agoI often simply change the colors for those. {} [] () , ; get the same colors as whitespaces (I enable their visibility but make them just a bit brighter as the background)
- Jtsummers 11y agoHe isn't saying you need a semicolon in particular, but rather something should be used for redundancy so when a user makes an error it is detectable. The semicolon is just an example. https://golang.org/ref/spec#Semicolons https://golang.org/ref/spec#Semicolons Go uses semicolons, they can be dropped in place of a newline (NB: So instead of a semicolon, a newline becomes the redundancy he speaks of) under specific conditions.
- Chabs 11y agoThe need for semicolons is easy to understand. It's required if you have operators that can be both binary and unary. Look at the following in non-semicoloned C: a + b *c - d is it one or two expressions?
- ufo 11y agoLua avoids this issue because it does not allow an statement to be just an expression.
- theseoafs 11y agof()
- ufo 11y agoFunction-call-statements are a special case. Not every expression can be turned into a statement. http://www.lua.org/manual/5.3/manual.html#3.3.6 http://www.lua.org/manual/5.3/manual.html#3.3.6 This gets rids of almost all the syntactic ambiguities. The only big one that is left is statements that start with parenthesis. http://www.lua.org/manual/5.3/manual.html#3.3.1 http://www.lua.org/manual/5.3/manual.html#3.3.1