4 ms·
Even C can't be parsed purely syntactically; you need to know whether or not an identifier names a type. C++ is worse: https://en.wikipedia.org/wiki/Most_vexing
by kps 4y ago
Even C can't be parsed purely syntactically; you need to know whether or not an identifier names a type. C++ is worse: https://en.wikipedia.org/wiki/Most_vexing_parse https://en.wikipedia.org/wiki/Most_vexing_parse
- vasilipupkin 4y agoright, so some simplifications or improvements are fine, but it doesn't follow that we should now have to type var, let or fn everywhere - it just makes the body of code a lot uglier auto time_keeper = TimeKeeper(Timer()); this is nice and clean
- Koshkin 4y agoCopy constructor much? (Also, I would take var over auto any day, to be honest; but no, they had to override the old useless keyword for some mysterious reason.)
- int_19h 4y agoThe reason is obvious: to avoid adding a new keyword and breaking existing code that might use it as an identifier.
- MindSpunk 4y agoWhich if you projected the same syntax to 'let' syntax you get: let time_keeper = TimeKeeper(Timer()); Which is one less character to type.
- Shish2k 4y ago> it just makes the body of code a lot uglier I’d suggest learning a couple more languages - after you’ve learned a few, you get used to it - you don’t even see the code. All I see is assignment, variable, parameter… (But seriously, the vast majority of imperative languages have syntax which is near-enough the same that it really doesn’t matter - much like two spaces vs four spaces, you can spend days, weeks, months arguing about which is better… or you can flip a coin, pick one, and after 5 minutes of using it you’re used to it, freeing up your brain to worry about more useful things :) )
- vasilipupkin 4y agomissing the point here, if the goal is to migrate people away from C++ to this new thing, it's easier. less error prone to keep syntax similar. That's why Java was so successful.