jdemeulenaere
06/26/2018, 1:29 PMgildor
06/27/2018, 12:48 AMjdemeulenaere
06/27/2018, 7:24 AMgildor
06/27/2018, 7:53 AMtry.getUnsafe()
and try!!
?try.getOrNull()
try.getOrDefault(someDefault)
try.getOrThrow(MyCustomException())
jdemeulenaere
06/27/2018, 7:55 AMgildor
06/27/2018, 7:55 AMtry?.value?.doSomething
? How this suppose to work if you want to consider Try as nullablejdemeulenaere
06/27/2018, 7:57 AMgildor
06/27/2018, 7:58 AMTry<String?>?
jdemeulenaere
06/27/2018, 7:59 AMgildor
06/27/2018, 8:00 AMjdemeulenaere
06/27/2018, 8:00 AMgildor
06/27/2018, 8:02 AMTry<String?>?
you have 3 different states:
non-nullable String in Success
nullable String in Success
Failure
And it’s easy to imagine cases when you want to distinguish all of themjdemeulenaere
06/27/2018, 8:02 AMgildor
06/27/2018, 8:02 AMjdemeulenaere
06/27/2018, 8:03 AMgildor
06/27/2018, 8:03 AMjdemeulenaere
06/27/2018, 8:03 AMgildor
06/27/2018, 8:03 AMTry<String?>?
you have Try<String?>
you have 3 states:
non-nullable String in Success
nullable String in Success
Failurejdemeulenaere
06/27/2018, 8:05 AMgildor
06/27/2018, 8:06 AMjdemeulenaere
06/27/2018, 8:06 AMgildor
06/27/2018, 8:08 AMBut you do realize that the ?. operator has the same semantics as flatMap right?Very similar, but you can nest monads (including Try), but you cannot nest nullable types
It would be possible, just a really bad practiceAlso agree with this, but you cannot prevent such usage. Because of this I’m asking how to handle those edge cases
jdemeulenaere
06/27/2018, 8:18 AM