Result

sealed class Result

The outcome of reflectively invoking a member via Ref.invoke, Ref.assign, or TypeRef.create: either None -- there was no return value, e.g. a void/Unit-returning method -- or a Value wrapping whatever was returned (including null).

This distinction exists because invoke_method/3 (it.unibo.tuprolog.solve.libs.oop.primitives.InvokeMethod) needs to unify its result argument with the returned Term only when one is actually available: unifying against "no value" would make invoking a void method deterministically fail rather than simply succeed without binding anything.

See also

Inheritors

Types

Link copied to clipboard
object None : Result

The result of invoking a member that returns no value.

Link copied to clipboard
data class Value(val value: Any?) : Result, TermConvertible

The result of invoking a member that returned value (null included).

Functions

Link copied to clipboard
open fun asNone(): Result.None?

This, cast to None, or null if this is not None.

Link copied to clipboard
abstract fun asObjectRef(): ObjectRef?

This result's value wrapped into an ObjectRef (even if it converts to a non-reference Term), or null if isNone.

Link copied to clipboard
open fun asValue(): Result.Value?

This, cast to Value, or null if this is not a Value.

Link copied to clipboard
open fun isNone(): Boolean

Whether this is None.

Link copied to clipboard
open fun isValue(): Boolean

Whether this is a Value.

Link copied to clipboard
abstract fun toTerm(): Term?

This result's value as a Term (via ObjectToTermConverter.default), or null if isNone.