OOPLib

The prolog.oop library, bridging the JVM/Kotlin object world with Prolog terms via reflection.

Loading this it.unibo.tuprolog.solve.library.Library (e.g. via Runtime.of(OOPLib), see it.unibo.tuprolog.solve.library.Runtime) into a it.unibo.tuprolog.solve.Solver lets Prolog clauses create JVM/Kotlin objects, invoke their (possibly overloaded) methods and constructors, read and write their properties, and convert values back and forth between the two worlds -- all without writing any custom Primitive by hand. This is what makes it possible, for instance, to script the standard library or any third-party JVM class directly from Prolog: new_object('java.util.ArrayList', [], L), L.add(1).

The library contributes:

Reflection-based method/constructor invocation (everything beyond alias/type-name resolution) is only implemented on the JVM target: see the platform notes on it.unibo.tuprolog.solve.libs.oop.allSupertypes, it.unibo.tuprolog.solve.libs.oop.fullName and the other expect declarations in TypeUtils.kt for what throws kotlin.NotImplementedError on Kotlin/JS.

See also

Properties

Link copied to clipboard
open override val alias: String
Link copied to clipboard
open override val clauses: List<Clause>
Link copied to clipboard
open override val functions: Map<Signature, LogicFunction>
Link copied to clipboard
open override val operators: OperatorSet
Link copied to clipboard
open override val primitives: Map<Signature, Primitive>
Link copied to clipboard

Functions

Link copied to clipboard
open operator fun contains(operator: Operator): Boolean
open operator fun contains(signature: Signature): Boolean
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open fun hasFunction(signature: Signature): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open fun hasPrimitive(signature: Signature): Boolean
Link copied to clipboard
open fun hasProtected(signature: Signature): Boolean
Link copied to clipboard
open override fun hasRule(signature: Signature): Boolean
Link copied to clipboard
open override fun toString(): String