logoalt Hacker News

mike_hearnyesterday at 1:57 PM1 replyview on HN

A lot of the language rules are required to make its approach to nullability work. Hence odd keywords like "lateinit var".


Replies

ZenDroidyesterday at 9:55 PM

`lateinit var` was not added to Kotlin to handle nullability, but to address specific Android design where system components like Activity cannot realisticly initialize fields in their constructors. Outside of Android it shouldn't be too commonly used.

show 1 reply