at that point, I think you're just trying to shoeh...
# getting-started
k
at that point, I think you're just trying to shoehorn this feature into a delegated property, and I'd just make a proper class like:
Copy code
class ResettableLazy<T>(val initializer: () -> T) {
  private var value: T? = null

  fun invalidate() { value = null }

  val value: T get() {
    if (value == null) {
      value = initializer()
    }
    return value!!
  }
}