Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

right, 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



> 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 :) )


missing 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.


Copy 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.)


The reason is obvious: to avoid adding a new keyword and breaking existing code that might use it as an identifier.


C++ had to add new keywords anyway.


It does, but N new keywords are always going to mean less breakage than N+1 new keywords.

On top of that, the best keywords - e.g. in this case "let" or "var" - are also the ones most likely to clash with identifiers in existing code.


Which if you projected the same syntax to 'let' syntax you get:

let time_keeper = TimeKeeper(Timer());

Which is one less character to type.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: