Package-level declarations

Types

Link copied to clipboard

The lifecycle allows plugins to subscribe to events such as engine and context configuration.

Link copied to clipboard

Represents a type-safe event key that can be dispatched by EngineLifecycle implementations, and consumed by plugins. Each event indicates the type of the subject provided to consumers using a generic type parameter.

Link copied to clipboard

Engine plugins provide a generic way to extend a PolyglotEngine and its PolyglotContext instances using an intuitive configuration DSL:

Link copied to clipboard

Represents a language supported by a PolyglotContext, providing a key for identification of guest bindings and other contextual elements.

Link copied to clipboard

A GuestLanguage feature for evaluating Source code in a given PolyglotContext.

Link copied to clipboard

A GuestLanguage feature for parsing Source code in a given PolyglotContext, returning an executable PolyglotValue.

Link copied to clipboard

Provides read-only information about the Host platform, which can be used by plugins to run platform-specific code.

Link copied to clipboard

Provides information about the runtime hosting the application.

Link copied to clipboard

The PluginRegistry interface defines the base contract for classes that allow installing and managing engine plugins.

Link copied to clipboard

The Polyglot Context is the core of the Elide runtime: it evaluates guest code in the embedded VM, returning the execution result. Context instances can be acquired from a PolyglotEngine.

Link copied to clipboard
typealias PolyglotContextBuilder = Context.Builder

A builder allowing configuration of PolyglotContext instances. Plugins can intercept builders to apply custom options using this class.

Link copied to clipboard

A type-safe key used to store and retrieve values in a PolyglotContext.

Link copied to clipboard

The Polyglot Engine is responsible for creating new PolyglotContext instances, as well as triggering events that allow plugins to extend the runtime.

Link copied to clipboard
typealias PolyglotEngineBuilder = Engine.Builder

A builder allowing configuration of PolyglotEngine instances. Plugins can intercept builders to apply custom options using this class.

Link copied to clipboard

This class acts as the root of the engine configuration DSL, allowing plugins to be installed and exposing general features such as enabling support for specific languages.

Link copied to clipboard
typealias PolyglotValue = Value

A value managed by the polyglot engine. It is common for instances to be obtained after evaluating guest code in a PolyglotContext.

Link copied to clipboard
data class Version(val major: Int, val minor: Int = 0, val patch: Int = 0) : Comparable<Version>

Represents a semantic version that can be compared with others or used to form a version range. Version objects are used to enable version-aware behavior in engine plugins.

Properties

Link copied to clipboard

Whether this OS family is UNIX-based. Returns true for LINUX and DARWIN enum entries.

Functions

Link copied to clipboard

Returns a version range including this and every higher version.

Link copied to clipboard

Returns a version range including this and every lower version.

Link copied to clipboard
fun PolyglotContext.evaluate(language: GuestLanguage, source: String, name: String? = null, internals: Boolean = false, interactive: Boolean = PolyglotDefaults.DEFAULT_INTERACTIVE, cached: Boolean = PolyglotDefaults.DEFAULT_CACHED, uri: URI? = null): PolyglotValue

Evaluate a fragment of source code in the specified language, returning the result of the execution. Depending on the configuration of the context, this method may fail if the language is not enabled in the underlying engine.

Link copied to clipboard
fun <C : Any, T : Any> PluginRegistry.getOrInstall(plugin: EnginePlugin<C, T>, configure: C.() -> Unit = { }): T

Returns the installed plugin instance from the registry, or throws IllegalStateException of no plugin instance is found.

Link copied to clipboard
inline fun <R> HostRuntime.on(version: Version, block: () -> R): R?

Execute a block and return its result if this runtime's is running the provided version, otherwise return null. If this runtime's version can't be detected, null will be returned.

inline fun <R> HostRuntime.on(range: Version.Range, block: () -> R): R?

Execute a block and return its result if this runtime's version is in the provided range, otherwise return null. If this runtime's version can't be detected, null will be returned.

Link copied to clipboard
fun PolyglotContext.parse(language: GuestLanguage, source: String, name: String? = null, internals: Boolean = false, interactive: Boolean = PolyglotDefaults.DEFAULT_INTERACTIVE, cached: Boolean = PolyglotDefaults.DEFAULT_CACHED, uri: URI? = null): PolyglotValue

Parse a fragment of source code in the specified language, returning the parsed value, which is typically executable. Depending on the configuration of the context, this method may fail if the language is not enabled in the underlying engine.

Link copied to clipboard

Returns the installed plugin instance from the registry, or null if this plugin is not installed.

Link copied to clipboard

Returns the plugin instance associated with the given key, or throws IllegalStateException of no plugin instance is found.

Returns the installed plugin instance from the registry, or throws IllegalStateException of no plugin instance is found.