rawtoast
01/24/2018, 1:48 PMOption(null)
(returns None
) and Some(null)
(returns an Option holding null
). It’s understandable but can be confusing and lead to bugs as not everyone knows this edge case. So for safety you end up creating/assigning with Option
and only using Some
for pattern matching/test assertions.
Not really tried that in Kotlin, as I tend to use Option.fromNullable which seems to work in a sane manner 🙂rawtoast
01/24/2018, 2:04 PMOption.fromNullable
works as I would’ve expected (passing in a null nullable returns an empty option)
In fact, I ended up writing a test for that exact scenario in my extension method (still on kategory here…)cedric
01/24/2018, 5:26 PMAndreas Sinz
01/24/2018, 6:16 PMrawtoast
01/25/2018, 8:28 AMnullable
. The languages definitely differ here