3 ms·
Kotlin seems pretty nice. Been using it a lot lately. It's not perfect since you can still get into trouble but it forces you to opt in to that. You need to add
by jillesvangurp 8y ago
Kotlin seems pretty nice. Been using it a lot lately. It's not perfect since you can still get into trouble but it forces you to opt in to that. You need to add a question mark to the type to indicate it is nullable and dereferencing without a null check is a compile error. You use two exclamation marks to bypass this to opt out of this. Of course if you are then wrong you may get npes.
But it works well enough that you can write code pretty easily that simply cannot produce npes. Excluding that as source of bugs is nice and should be built into any new language.