version bump, better diagnostic on unknown object serialization
This commit is contained in:
parent
e8f0846840
commit
dc3000e9f7
@ -19,12 +19,13 @@ fun naiveCountHappyNumbers() {
|
|||||||
import lyng.time
|
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 start = Instant.now()
|
||||||
val found = naiveCountHappyNumbers()
|
val found = naiveCountHappyNumbers()
|
||||||
println("Found happy numbers: %d time %s"(found, Instant.now() - start))
|
println("Found happy numbers: %d time %s"(found, Instant.now() - start))
|
||||||
assert( found == 55252 )
|
assert( found == 55252 )
|
||||||
delay(0.1)
|
delay(0.05)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
|||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
|
||||||
group = "net.sergeych"
|
group = "net.sergeych"
|
||||||
version = "0.10.1-SNAPSHOT"
|
version = "0.10.2-SNAPSHOT"
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@ -124,7 +124,7 @@ open class Obj {
|
|||||||
* @param calledFromLyng true if called from Lyng's `toString`. Normally this parameter should be ignored,
|
* @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
|
* 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
|
return if (this is ObjString) this
|
||||||
else if( !calledFromLyng ) {
|
else if( !calledFromLyng ) {
|
||||||
invokeInstanceMethod(scope, "toString") {
|
invokeInstanceMethod(scope, "toString") {
|
||||||
@ -265,7 +265,7 @@ open class Obj {
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun invoke(scope: Scope, thisObj: Obj, args: Arguments): 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 ->
|
scope.withChildFrame(args, newThisObj = thisObj) { child ->
|
||||||
callOn(child)
|
callOn(child)
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ open class Obj {
|
|||||||
open suspend fun lynonType(): LynonType = LynonType.Other
|
open suspend fun lynonType(): LynonType = LynonType.Other
|
||||||
|
|
||||||
open suspend fun serialize(scope: Scope, encoder: LynonEncoder, lynonType: LynonType?) {
|
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 {
|
fun autoInstanceScope(parent: Scope): Scope {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user