does anyone know why they use R to specify the gen...
# android
d
i
You can use whatever letter or combination of letters you want. A result of type R makes sense
d
Why would T not make more sense? Would that provide a tighter contract with the success class?
also - thank you for the reply
i
The name does not matter. At all. You could call it
ResultType
if you want
👍 3
v
I guess the main reason (besides that
R
can be used if they want) is, that within they use
T
for the subclasses of the sealed class that uses `R`:
👍 1
That would probably clash
d
Would you want a Result Type that matches the Data type you are looking for a result of? I guess I am confused why you would want different types. For example
Result<Foo>
would have a sealed class with
Success<Foo>
that contains
val data: Foo
v
Probably more like "local variable with that name already defined". The inner class has its own type variable.