A lot of newer languages seem to prefer the return type coming after the function declaration. I suspect some people believe it's better for newer programmers.
Whether or not that's true I don't know, but as someone who has a project that's written in C++ and Angular (Typescript), I will say that a lot of the typescript code tends to look cleaner aesthetically than the C++ does. Granted, the C++ is usually doing much more complicated things.
The issue then becomes tooling - C++ is famously hard to parse and for 20+ years this has made linters and smart editors etc hard to write or easy to break.
Don't get me wrong - I'm also a big perl fan and perl's syntax was designed by a linguist so contains natural language principles that favour the human reader (once they get over the $ and @ stuff that makes sense once you see them as human linguistic constructs - see "Disambiguation by number, case and word order" and "Pronominalization" in the doc above) but in return, perl is hard to parse to the point where it has been proven that "only Perl (the executable) can parse perl (the language)".
I'm not saying you have to agree with the "natural language principles" or the trade-off that perl took, but I think it's useful to examine it as attempting to make the language for the human reader and recognise the issues this has.
That is true. Almost none of that is caused by function argument preceding the function name or other things people like. It could be fixed with minor changes that wouldn't bother anyone.
-7
u/ShakaUVM i+++ ++i+i[arr] Sep 17 '22
Does rewriting C++ to look like Rust make it as safe as Rust? Why not leave the syntax alone? I don't like return values after functions.