hi everyone. I want to know why there isn't someth...
# announcements
r
hi everyone. I want to know why there isn't something like
lateinit val
which is immutable after the initialization...? in my practice actually my
lateinit
is always for this immutable occasion... A friend of mine said that in the early version of Kotlin there is something like that, but then it's withdrawn. BTW, in KotlinConf 2018 Closing Panel many a speaker regarded
lateinit
as their most annoying Kotlin feature, and seems lots of audience agreed the opinion. I am wondering if this is because of the problem mentioned above...
c
I think what you are looking for it
Copy code
// replace random logic with whatever makes sense for you
val x by lazy { Random(3).nextInt() }