4 ms·
> why type var in front of a variable when int x makes it clear its a variable? Unless `int x` is followed up by an opening parenthesis, in which case it sudde
by alpaca128 4y ago
> why type var in front of a variable when int x makes it clear its a variable?
Unless `int x` is followed up by an opening parenthesis, in which case it suddenly is a function definition and not a variable. Which also means a parser now needs lookahead for one of the most common statements in the language.
`let` means variable, always. Not only that but in most cases (>90%) you can omit the type as it's obvious. Now you just have to type `let s` instead of `String s`, with the difference that `let` also tells you this variable is immutable, which isn't even possible in many languages in the first place.
> involves typing one more character
Who cares. 99% of devs don't, otherwise they'd use APL or its relatives, where the entire Conway's Game of Life is a single line. There are more important factors than the number of symbols on screen.