PatchDecision

class PatchDecision(val replaces: Boolean, val value: Any?)

What a writable patch's callback answers with. Built only by Patches.proceed / Patches.returns, so a script never names this type.

It exists to make the callback's return type something other than Any?. With Any?, a Kotlin lambda whose last expression is args[0] = x returns Unit — non-null, and therefore a short-circuit with a garbage value. Typed, that lambda does not compile.

Constructors

Link copied to clipboard
internal constructor(replaces: Boolean, value: Any?)

Properties

Link copied to clipboard
internal val replaces: Boolean

False for Patches.proceed: run the body / keep the return value.

Link copied to clipboard
internal val value: Any?

The substitute return value. Ignored unless replaces; may itself be null.

Functions

Link copied to clipboard
open override fun toString(): String