Created
January 17, 2022 20:11
-
-
Save sdboyer/388882d9e442d9d646bf4b968f8bd0d0 to your computer and use it in GitHub Desktop.
joinSchema as open struct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Core Thema definition | |
#Lin: { | |
joinSchema: _ | |
sch: joinSchema | |
} | |
///////////////////// | |
// Lineage subtype def (proposed to be new core joinSchema def) | |
#B: #Lin & { | |
joinSchema: {...} | |
} | |
// instance of #B lin that leaves schema open | |
#openlin: #B & { | |
sch: { | |
bfield: string | |
} | |
} | |
// instance of #B lin that forces schema closed. This is | |
// probably discouraged, but still figuring out guidance | |
#closedlin: #B & { | |
sch: close({ | |
bfield: string | |
}) | |
} | |
Binstopen: #openlin.sch & { | |
bfield: "hi" | |
ack: "hoo" | |
} | |
Binstclosed: #closedlin.sch & { | |
bfield: "hi" | |
// ack: "hoo" // not allowed, errors if uncommented | |
} | |
///////////////////// | |
// A def that forces the sch closed | |
#typ: { | |
must: {...} | |
} | |
#C: #B & { | |
joinSchema: #typ | |
} | |
#clin: #C & { | |
sch: { | |
// notallowed: string // not allowed, errors if uncommented | |
must: { | |
cfield: string | |
} | |
} | |
} | |
// Embedding still allows bypassing of def-closure | |
#Cembed: { | |
#clin.sch | |
local: string | |
} | |
embedded: #Cembed & { | |
local: "a local string" | |
must: { | |
cfield: "joinSchema-specified string" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment