Re:From zero to 10M lines of Kotlin
by MajimasEyepatch on Tuesday October 25, 2022 @10:30AM
(#33330928)
In practice, the return type is often obvious. You can write:
instead of:
And you never _have_ to use type inference. If you have a method where the return type isn't as obvious, you can always annotate it explicitly:
Do people exercise judgement about when to make the type explicit? Eh, depends on the team. But if you combine type inference with established conventions in a particular codebase (e.g. I/O calls always return IO[Foo]), you will rarely be left wondering what the type of something is.
[ Parent
| on HN ]
There are no comments on this comment yet.