|
|
|
|
|
by kjeetgill
1055 days ago
|
|
A ton of comments are missing the point of this complaining about list/map syntax etc. I'm not sure if the kotlin lazy addresses this. The point is that static final variables interact especially well with the JIT's constant folding machinery. But lazy loading a constant necessitates that it can't be final: it's initially null until it's effectively final after the first lazy load. This finality is clear to the developer but not to the JVM. This is introduces a way to implement lazy constants via a blessed class that solves this. The article is pretty clear about what the point is — but does require some careful reading and context. |
|