This is something I wanted to ask for a long time. Now it struck my mind again. Type inference works well for non-null vars, e.g.
val str1 = "foo"
But for optional nulls type inference seems not to work:
val str2? = "bar" // compiler error val str2 = "bar"? // compiler error
Think I tried out all positions where you can put the ?. Seems like I have to declare the type explicitly for things to compile if the var may be null:
val str: String? = "baz" // compiles fine
While this is not really dramatic, it still feels a bit like a nuisance. Am I doing something wrong or could it be done in the compiler? Just curious ...
P.S.: Thanks for M9. Kotlin is now in a state that you can really develop with it