Rob Pike famously explained that C needed its space-insensitive braces and semicolons in case code was transmitted through a channel that mangled whitespace.
Those days predate most people reading this, yet many new language syntaxes opt for "familiarity". I wish that all language design went through a filter where every character mattered like the designer was in an episode of Squid Game.
Bill Joy famously explained that syntax matters, a dense syntax puts more on screen. This is true even now. I struggle with this; my favorite syntax is a preprocessor that eliminates the need for most Lisp parentheses. The result is code poetry. Nevertheless, Haskell is more expressive.
(Here's an easy test: Anyone who proposes a way to minimize Lisp parentheses, who hasn't introduced a symbol for missing outline levels, is just pulling out chunks and hasn't used their system to write thousands of lines of code.)
I've written most of my lifetime of code in C, established my career in C, and C syntax is ground glass in my eyes.
> I wish that all language design went through a filter where every character mattered like the designer was in an episode of Squid Game.
Yes, I totally support this! Coming from languages like Haskell, most languages look so unnecessarily noisy to me. Cut the fat!
> Anyone who proposes a way to minimize Lisp parentheses, who hasn't introduced a symbol for missing outline levels, is just pulling out chunks and hasn't used their system to write thousands of lines of code.
What are outline levels? I tried Googling it but didn't find anything.
> C syntax is ground glass in my eyes.
Is that a good thing? I'm not sure what you mean by it.
> Rob Pike famously explained that C needed its space-insensitive braces and semicolons in case code was transmitted through a channel that mangled whitespace.
Interesting.
And later when he (along with his collaborators) created Go, he moved with the times and avoided the need for semicolons.
Alongside they also shipped a tool that handles formatting so people can stop talking about that.
Not only that, afaik they pioneered/popularized a style of coding where the formatter is always correct, not the coder. This made coding on every language much more enjoyable and more efficient.
This is not something to write papers about, but a very significant thing anyway.
Anecdotal of course, but a teacher of mine worked on the original Ada compiler and said each dev had their own formatting rules. The SVN had an unformatted version and everyone could format it locally. Not the exact same, but pretty similar.
>Rob Pike famously explained that C needed its space-insensitive braces and semicolons in case code was transmitted through a channel that mangled whitespace.
But did he explain why it used semicolons, rather than periods, which would make more sense because a statement is basically a sentence?
Periods are in struct.member identifiers and also in floating points. Using them again for end of statement would be complicated[1].
Imagine that your statements are "x = y.x = z." The compiler needs to figure out if that middle dot is saying "x member of y" or if it's a statement terminator.
[1]: It's already complicated by that reuse, which is, I assume, why identifiers can't start with digits so your parser can be simpler.
I assume that the statement terminator was chosen first, so they could've used something else for member access, such as `\`. Though I don't know about floats.
They could have used a comma for floats, as is common in many non-English-speaking countries. Although I guess that might become ambiguous with its use as a parameter separator.
Other reasons for the a bit of noise: speed, simplicity and unambiguity of parsing. (Impacts compilation speed, ease of additional tool development, and ability to continue parsing partially incorrect code)
Nim, last I used it a couple of years ago, stopped at the first compilation error. It's not such a bad idea considering errors are usually fixed one-at-a-time.
I'd gladly trade a little compilation speed and ability to continue parsing incorrect code for a syntax without semicolons, braces, and other unnecessary characters. It's one of the things I really like about Python, though even that is starting to add lots of syntaxy glyphs.
Those days predate most people reading this, yet many new language syntaxes opt for "familiarity". I wish that all language design went through a filter where every character mattered like the designer was in an episode of Squid Game.
Bill Joy famously explained that syntax matters, a dense syntax puts more on screen. This is true even now. I struggle with this; my favorite syntax is a preprocessor that eliminates the need for most Lisp parentheses. The result is code poetry. Nevertheless, Haskell is more expressive.
(Here's an easy test: Anyone who proposes a way to minimize Lisp parentheses, who hasn't introduced a symbol for missing outline levels, is just pulling out chunks and hasn't used their system to write thousands of lines of code.)
I've written most of my lifetime of code in C, established my career in C, and C syntax is ground glass in my eyes.