News for hackers. Stuff that matters.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by mike_hearn on Friday June 19, 2026 @09:57AM (#48598658)
A lot of the language rules are required to make its approach to nullability work. Hence odd keywords like "lateinit var".
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by ZenDroid on Friday June 19, 2026 @05:55PM (#48603724)
`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.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by mike_hearn on Friday June 19, 2026 @05:59PM (#48603768)
"lateinit var" predates Android's adoption of Kotlin by years and was added because fields initialized after construction by frameworks are common in many contexts, but having nullability in the language makes that annoying.