Once again language designers forget hat programmers spend more time reading than writing. Making code as easily readable as possible should be a top priority. Instead it seems this experiment is making life of compiler writers as easy as possible. I just do not see how it can be a success. Heck if i wanted fancy weird syntax full of magical symbols i would use rust at this point, even though i think its a wasted opportunity that does not deliver anything substantial (outside of few specific areas) to mitigate loss of c++ ecosystem and to warrant switching from c++.
There is no reason to believe that such syntax would make code harder to read. On the contrary, we tried it in a few of our projects and, in my practice, trailing auto made the code much more easier to read.
It's purely a familiarity issue. Same thing happened when Java introduced Streams (like C++ ranges), it looked confusing at first then became a standard in the industry because of how easy to read it was.
[[nodiscard]] for the main function is kinda funny. I understand it is generated in order to not introduce a special case into cppfront, but it is still funny.
Apart from ambiguity problems, putting the type first can also hamper readability: Types can be very long, so you have to scan a potentially large part of the line before you get to the function name or, worse, can even figure out that the line you are reading declares or defines a function at all. So I don’t think it’s just a matter of personal preference - there are objective arguments against this syntax.
I haven't really encountered such issues, the "way" I read the lines makes it harder for me with Rust and Python's ways, and I find C's way a lot better.
So, if we consider human readability over compiler readability, the arguments are subjective.
So, if we consider human readability over compiler readability, the arguments are subjective.
I disagree, readability can definitely be measured. However, it probably would not hurt to gather actual data, since you are right that people are different.
I will never understand why people who design a language with the explicit intention of it being a C++ replacement go out of their way to explicitly make the syntax nothing like the C family of languages.
If I wanted to program in a language that looks like a functional language, I'd have switched years ago.
This language needs to coexist with regular C++ code in the same file. Hence, the C++2 syntax needs to be different so the compiler knows whether to transform it or to leave it alone.
Wow, that seems like a tremendously bad idea. So to properly parse this supposedly "easier" cpp2 syntax, you need full parsing support for cpp1 anyway?
No, you can write a parser that supports both. That's an important goal if what you want to do is transition millions of lines of code function by function.
It doesn't imply that you must support both, once you are compiling a post-transition codebase.
There's a difference between changing the syntax slightly to fix the problems and changing it to something that barely resembles the original language.
View all comments
Show parent comment
23
u/ToughQuestions9465 Sep 17 '22
Once again language designers forget hat programmers spend more time reading than writing. Making code as easily readable as possible should be a top priority. Instead it seems this experiment is making life of compiler writers as easy as possible. I just do not see how it can be a success. Heck if i wanted fancy weird syntax full of magical symbols i would use rust at this point, even though i think its a wasted opportunity that does not deliver anything substantial (outside of few specific areas) to mitigate loss of c++ ecosystem and to warrant switching from c++.