dalexander
03/15/2018, 5:18 PMRuckus
03/15/2018, 5:20 PMdalexander
03/15/2018, 5:26 PMfun doSomethingUnreliable(): (Result | Error) { ... }
which is awkward to express currently even though you could use union types. This is less of a problem in Java because of checked exceptions, which are a feature I don’t generally like despite their occasional utility.Ruckus
03/15/2018, 5:34 PMdalexander
03/15/2018, 5:40 PM(String | Int)
in Javascript from a function, which I wasn’t particularly happy to discover, but I think that’s more a function of JS’s lack of types and the developer’s lack of experience than the concept.Ruckus
03/15/2018, 5:58 PMString | Int
be represented on the JVM? Either an erased generic, which means the compiler has to generate a lot of type checking on the fly (like Kotlin does for nullability checking, but with WAY more overhead), or by creating some sort of combination types on the fly, which leads to massive compiler complexity (in addition to already having all the extra type objects), which is a death sentence for evolving the language over time.dalexander
03/15/2018, 6:03 PMRuckus
03/15/2018, 6:06 PMnish
03/15/2018, 7:58 PMI’d like to be able to force function consumers to consider the error case with something likeSounds to me like what you want to expose isfun doSomethingUnreliable(): (Result | Error) { ... }
fun <T> doSomething(): Result<T, Error>
nish
03/15/2018, 7:59 PMdalexander
03/15/2018, 8:05 PMnish
03/15/2018, 8:10 PMnish
03/15/2018, 8:11 PMnish
03/15/2018, 8:12 PMRuckus
03/15/2018, 8:16 PMdalexander
03/15/2018, 8:59 PMgildor
03/16/2018, 12:19 AMnish
03/16/2018, 4:06 AMgildor
03/16/2018, 7:02 AMdh44t
03/16/2018, 9:59 AM