3 ms·
Yes, precisely. C, for the most part (function pointers are an exception) has a pleasant syntax. Go didn't like semicolons and other stuff that it found unnee
by luckydude 9y ago
Yes, precisely. C, for the most part (function pointers are an exception) has a pleasant syntax. Go didn't like semicolons and other stuff that it found unneeded, but mostly took a lot of syntax from C so it's easy to read Go code even without understanding the language.
Rust kind of went in a different direction. Why? Understanding C syntax is pretty basic, there are a lot of C like languages. Why not be another one?
Personally, if every language was just a C variant I'd be happier. It would feel like "OK, I've got the basics down, let's go explore this dialect that added garbage collection and strings as real types" rather than "I want strings as real types, darn it, I need to go learn this Tcl language". That might be an extreme way to make my point, but I think it's clear, right?
- jjuel 9y agoWhat about the people that don't like the C style syntax? I think there is room for many different types of syntax. Just stick to the style of languages you like and ignore the ones you don't. Pretty simple.
- ufo 9y agoOther than its ubiquity, there are lots of bad thigns about C's syntax: * Assignment as an expression is bug-prone * The precedence for the binary operators is wonky * Optional braces in if statements make the grammar ambiguous and is also bug prone (the infamous Apple goto bug) * The type-declaration syntax is convoluted and people need tools like cdecl to understand the more tricky ones. * The cast syntax is ambiguous and resolving this ambiguity relies on adding dirty hacks to the lexer to tell the parser about type names.
- p0nce 9y ago> Assignment as an expression is bug-prone Can be fixed without syntax change other than returning void. > The precedence for the binary operators is wonky But that's the precedence everyone is accustomed with. D enhance this by forbidding some non-parenthesized dangerous expressions. > Optional braces in if statements make the grammar ambiguous and is also bug prone (the infamous Apple goto bug) I've definately seen such bugs. > The type-declaration syntax is convoluted and people need tools like cdecl to understand the more tricky ones. This is fixed in languages that still feel C-like in syntax. > The cast syntax is ambiguous and resolving this ambiguity relies on adding dirty hacks to the lexer to tell the parser about type names. Yup.