thana
06/03/2019, 10:12 AMwhen(someSealedClass)
? I just came across a piece of code where it was very natural to use then when
without any assignment, hence the compiler would never complain when a branch was missing 🤔thana
06/03/2019, 10:13 AMwhen
to a variable, but this way the code actually gets more complicatedribesg
06/03/2019, 10:14 AMhho
06/03/2019, 10:15 AM.exhaustive()
trick explained here: https://proandroiddev.com/til-when-is-when-exhaustive-31d69f630a8bthana
06/03/2019, 10:19 AMribesg
06/03/2019, 10:22 AMgildor
06/03/2019, 10:34 AMgildor
06/03/2019, 10:34 AMthana
06/03/2019, 10:36 AMcheckForExhaustiveness
at least tells what it is good for. i think hashcode
is so undescriptive that one day some developer could think about what that is good for and simply remove it, because it doesnt have any obvious usegildor
06/03/2019, 10:37 AMhho
06/03/2019, 10:41 AM.also { /* check exhaustiveness */ }
… and have that as a live template …gildor
06/03/2019, 10:42 AMJonathan Mew
06/03/2019, 11:56 AMJonathan Mew
06/03/2019, 11:56 AMhho
06/03/2019, 11:57 AM