diff --git a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/extensions.kt b/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/extensions.kt index cba4bbb13..b790a3a88 100644 --- a/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/extensions.kt +++ b/kmath-ast/src/commonMain/kotlin/kscience/kmath/ast/extensions.kt @@ -1,22 +1,12 @@ package kscience.kmath.ast import kscience.kmath.operations.Algebra +import kotlin.properties.PropertyDelegateProvider import kotlin.properties.ReadOnlyProperty -import kotlin.reflect.KProperty /** - * Stores `provideDelegate` method returning property of [MST.Symbolic]. + * Returns [PropertyDelegateProvider] providing [ReadOnlyProperty] of [MST.Symbolic] with its value equal to the name + * of the property. */ -public object MstSymbolDelegateProvider { - /** - * Returns [ReadOnlyProperty] of [MST.Symbolic] with its value equal to the name of the property. - */ - public operator fun provideDelegate(thisRef: Any?, prop: KProperty<*>): ReadOnlyProperty = - ReadOnlyProperty { _, property -> MST.Symbolic(property.name) } -} - -/** - * Returns [MstSymbolDelegateProvider]. - */ -public val Algebra.symbol: MstSymbolDelegateProvider - get() = MstSymbolDelegateProvider +public val Algebra.symbol: PropertyDelegateProvider, ReadOnlyProperty, MST.Symbolic>> + get() = PropertyDelegateProvider { _, _ -> ReadOnlyProperty { _, p -> MST.Symbolic(p.name) } }