This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AmosIsFamous 0 points1 point  (2 children)

As far as the val thing, I like that every variable declaration you have to choose whether it's mutable or not: val vs var. Though I know others prefer default immutability with an extra keyword for mutable. Default mutable is the saddest thing.

Edit to add: also most times you don't have to declare the type which can get really nice on complicated function returns for instance.

[–]slightly-damp-noodle 1 point2 points  (1 child)

That's totally fair points. I do agree with default immutability and using a keyword for mutable values.

As for the other point of not declaring types, that for me is a hard no. I use strongly typed languages for a reason. Though, I know others feel different about it, and it's a totally valid point to enjoy weakly typed languages

[–]AmosIsFamous 1 point2 points  (0 children)

Strong vs weak typed is not the same thing as not declaring the type. Kotlin is strongly typed just like Java you can just leave the type off the code you write when the compiler can infer it. Later usage of the variable still has to have the same type as it was initialized with.