Skip to content

Instantly share code, notes, and snippets.

View kriskowal's full-sized avatar

Kris Kowal kriskowal

View GitHub Profile
@kriskowal
kriskowal / plains.kni
Last active December 30, 2025 23:44
Kni Interactive Fiction Script (The Plains)
Now you'}re on the plains.
+ [Go to the forest. ]
{The Forest https://kni.kriskowal.com/?gist=3fb037ddc919f101e638a49896d66d50&theme=forest}.
>
@kriskowal
kriskowal / forest.kni
Last active December 30, 2025 23:46
Kni Interactive Fiction Script (The Forest)
Now you'}re in a forest.
+ [Go to the plains. ]
{The Plains https://kni.kriskowal.com/?gist=3b480886acf6bd7eebb1cde062fd3e21&theme=sky}.
>
@kriskowal
kriskowal / archery.kni
Created December 30, 2025 00:35
Example Kni game adventure.
! gold = 2
arrow = 0
score = 0
You enter the fletcher'}s shop. The fletcher beckons, {"There are arrows for
sale and a range out back to try your skill and fortune. For each score hit,
you win more gold!"} //
- @shop

SharedStructs are to be declarations, like class declarations, that may appear in module source text. Instances of a shared struct are JavaScript primitives and, like all other JavaScript primitives, share a per-Realm prototype instance. So, like 1..toString() looks up the %NumberPrototype% intrinsic for the realm in the current execution context in order to call its toString method, when we have a struct instance s, calling s.toString() will look up the struct’s corresponding prototype on the realm in the current execution context. The key space for that table closes over the key space of the realm’s module map and also includes the position of the struct declaration. Consequently, shared struct declarations must instantiate all contained prototypes once per evaluation of a module in the realm’s module map.

I am comfortable with this strategy in anticipation of a suitable intersection semantics for Module Harmony proposa

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import { makeStream, nullQueue } from '@endo/stream';
/**
* @template TValue
*/
const makePubSub = () => {
// Request pubsub async queue internals
let { promise: tailPromise, resolve: tailResolve } = makePromiseKit();
import { makeStream, nullQueue } from '@endo/stream';
/**
* @template TValue
*/
const makePubSub = () => {
// Request pubsub async queue internals
let { promise: tailPromise, resolve: tailResolve } = makePromiseKit();
const makeNearReader = reader =>
Far('Reader', {
async next() {
const iteration = await reader.next();
if (iteration.done) {
return iteration;
}
return harden({ value: encodeBase64(iteration.value) });
},
async return(value) {
{
"colors": {
"darkBlue": "#61B2E4",
"darkRed": "#D22F27",
"darkGreen": "#5C9E31",
"lightPurple": "#B399C8"
},
"levels": [
{
"topology": "torus",