KotlinExprEvaluatorPool

class KotlinExprEvaluatorPool @JvmOverloads constructor(size: Int, resetEvery: Int = DEFAULT_RESET_EVERY) : AbstractExprEvaluatorPool<KotlinExprEvaluator>

A pre-populated pool of KotlinExprEvaluator instances backed by a coroutine Channel.

Instances are created eagerly during initialization.

A fresh Kotlin REPL costs several times an evaluation, and each evaluation adds to the REPL's history, so an evaluator's context is reset every resetEvery returns rather than every time: about 20 keeps the reset cost small per evaluation while holding each evaluator's history to some tens of megabytes. See AbstractExprEvaluatorPool.

Parameters

size

the number of KotlinExprEvaluator instances to create in the pool

resetEvery

how many times an evaluator is returned between resets of its context; defaults to DEFAULT_RESET_EVERY, and 1 resets on every return

Constructors

Link copied to clipboard
constructor(size: Int, resetEvery: Int = DEFAULT_RESET_EVERY)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val size: Int

Functions

Link copied to clipboard
Link copied to clipboard
open override fun close()
Link copied to clipboard
suspend fun eval(expr: String): Boolean