missed file

This commit is contained in:
Sergey Chernov 2025-05-31 23:44:07 +04:00
parent d2c732ceef
commit 86d59abfbc

View File

@ -0,0 +1,19 @@
package net.sergeych.ling
class ObjChar(val value: Char): Obj() {
override val objClass: ObjClass = type
override suspend fun compareTo(context: Context, other: Obj): Int =
(other as? ObjChar)?.let { value.compareTo(it.value) } ?: -1
override fun toString(): String = value.toString()
override fun inspect(): String = "'$value'"
companion object {
val type = ObjClass("Char").apply {
addFn("code") { ObjInt(thisAs<ObjChar>().value.code.toLong()) }
}
}
}