version bump, better diagnostic on unknown object serialization

This commit is contained in:
Sergey Chernov 2025-11-11 15:40:00 +01:00
parent e8f0846840
commit dc3000e9f7
3 changed files with 9 additions and 8 deletions

View File

@ -19,12 +19,13 @@ fun naiveCountHappyNumbers() {
import lyng.time
//
// After all optimizations it takes ~120ms.
// After all optimizations it took ~120ms - before.
//
for( r in 1..100 ) {
for( r in 1..900 ) {
val start = Instant.now()
val found = naiveCountHappyNumbers()
println("Found happy numbers: %d time %s"(found, Instant.now() - start))
assert( found == 55252 )
delay(0.1)
}
delay(0.05)
}

View File

@ -21,7 +21,7 @@ import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
group = "net.sergeych"
version = "0.10.1-SNAPSHOT"
version = "0.10.2-SNAPSHOT"
buildscript {
repositories {

View File

@ -124,7 +124,7 @@ open class Obj {
* @param calledFromLyng true if called from Lyng's `toString`. Normally this parameter should be ignored,
* but it is used to avoid endless recursion in [Obj.toString] base implementation
*/
suspend open fun toString(scope: Scope,calledFromLyng: Boolean=false): ObjString {
open suspend fun toString(scope: Scope,calledFromLyng: Boolean=false): ObjString {
return if (this is ObjString) this
else if( !calledFromLyng ) {
invokeInstanceMethod(scope, "toString") {
@ -265,7 +265,7 @@ open class Obj {
}
suspend fun invoke(scope: Scope, thisObj: Obj, args: Arguments): Obj =
if (net.sergeych.lyng.PerfFlags.SCOPE_POOL)
if (PerfFlags.SCOPE_POOL)
scope.withChildFrame(args, newThisObj = thisObj) { child ->
callOn(child)
}
@ -300,7 +300,7 @@ open class Obj {
open suspend fun lynonType(): LynonType = LynonType.Other
open suspend fun serialize(scope: Scope, encoder: LynonEncoder, lynonType: LynonType?) {
scope.raiseNotImplemented()
scope.raiseNotImplemented("lynon: can't serialize ${this.objClass}:${this.toString(scope)}")
}
fun autoInstanceScope(parent: Scope): Scope {