diff --git a/README.md b/README.md index 0d98b6e..9b79d83 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ -editor -[Exprimental] Online IDE for kin-lang +# Kin online editor (experimental) + +Web playground for [Kin](https://github.com/kin-lang/kin). + +## Notes + +- The playground runs a **single buffer** in the browser. +- Multi-file modules (`koresha "…" nka alias` / `emerera_gukoresha`) need the **CLI** + (`kin run entry.kin`) so files can be loaded from disk. See `examples/importing/` + in the language repo and the [Modules](https://kinlang.vercel.app/docs/language-structure/Modules) docs. +- Typed samples and OOP/`ubwoko` printing are aligned with recent Kin releases when + `@kin-lang/kin` is updated in this package. diff --git a/lib/runtime.ts b/lib/runtime.ts index 88a74f8..72b9062 100644 --- a/lib/runtime.ts +++ b/lib/runtime.ts @@ -50,6 +50,29 @@ export function matchType(arg: RuntimeVal): any { internal: false, }; } + case "class": { + const c = arg as RuntimeVal & { name?: string }; + return c.name ?? "imiterere"; + } + case "instance": { + const inst = arg as RuntimeVal & { + klass?: { name?: string }; + fields?: Map; + }; + const fields: { [key: string]: unknown } = {}; + inst.fields?.forEach((value, key) => { + fields[key] = matchType(value); + }); + return `${inst.klass?.name ?? "instance"} ${JSON.stringify(fields)}`; + } + case "type-val": { + const t = arg as RuntimeVal & { name?: string }; + return t.name ?? "type-val"; + } + case "bound-method": { + const bm = arg as RuntimeVal & { method?: { name?: string } }; + return ``; + } default: return arg; }