holgerbrandl
04/17/2018, 7:41 AMUnit is the void equivalent, why is it assignable in kotlin but not in java?Ruckus
04/17/2018, 6:05 PMUnit isn't the void equivalent. The problem is void in Java is playing two roles and doesn't distinguish between them. Java can't distinguish between a function that returns, but doesn't return a useful value (Unit in Kotlin () in Rust, etc.) and a function that doesn't return at all (usually called a diverging function) (Nothing in Kotlin, ! in Rust, etc.)Ruckus
04/17/2018, 6:07 PMUnit + Nothing is the equivalent of Java's overly vague void.