raulraja
05/15/2020, 7:55 PMjulian
05/15/2020, 8:23 PMhelp
returns String?
, not String
? I ask, because I noticed that name and hash aren't optional, and the union doesn't appear to allow for null of either type. Does the compiler not know that returning null from help
isn't possible? Is it possible?raulraja
05/16/2020, 10:26 AMString
.
To your second question yes once that was expressed as pattern matching the compiler knows unless the union includes nullable types in which case the union is of type:raulraja
05/16/2020, 10:26 AMA | B | C | null
raulraja
05/16/2020, 10:27 AMA? | B? | C?
raulraja
05/16/2020, 10:27 AMjulian
05/16/2020, 11:46 AMBob Glamm
05/18/2020, 1:49 PMA | B | C | null
syntax but including null
as a type looks weird to me, because nullable types in Kotlin suggest that null
is a value, not a typeBob Glamm
05/18/2020, 1:50 PMString | Int | Double?
or (worse) String? | Int | Double?
raulraja
05/18/2020, 2:36 PMraulraja
05/18/2020, 2:36 PMraulraja
05/18/2020, 2:37 PMString | Int | Double | null
raulraja
05/18/2020, 2:38 PMraulraja
05/18/2020, 2:39 PMBob Glamm
05/18/2020, 4:41 PMA | B | C | null
is isomorphic to A | B | C | Unit
Bob Glamm
05/18/2020, 4:42 PMnull
would be preferable to using Unit
raulraja
05/18/2020, 6:07 PMraulraja
05/18/2020, 6:07 PMraulraja
05/18/2020, 6:08 PMraulraja
05/18/2020, 6:08 PM