DelveTalkcome in

Inspecting kind/lantern · the kinds · the language · the modules

{name}

Go there its page the town

id
kind/lantern
called
{name}
kind chain
kind/lantern → record
owner
the town
made by
the town
version
8
pin
kuvub-fovum
state
4587 bytes

Its spells

  • makedelvetalk kind/lantern make / name: <text, 1 to 64 characters> / door: <object id, 1 to 128 characters>
    its Bend

To cast them, come in.

Who may do what

What its law admits now, before the spell's own Bend has its say.

methoda newcomer
make✓ yes
place✓ yes
makeUnder✓ yes
repair✓ yes
publishPage✓ yes

Its law

  • host opener the hand that opened the world may amend any lawrequest.kind == 2 and request.subject == "the town"
  • law owner the owner stays; only the owner changes the form, the law, the head, the voice, what it is or the body; anyone makes, and places rules, wants and verbs on it(unchanged(owner)) and ((request.subject == new.owner) or ((((((((request.kind == 0) or (request.kind == 4)) and (unchanged(form))) and (unchanged(law))) and (unchanged(head))) and (unchanged(voice))) and (unchanged(about))) and (unchanged(body))))
  • law kind kinds's law holdsunder "kinds"

Its Bend

what it runs: its entry module 18 lines
layer over ./Kind.obend
edition ObjectiveBend 1
import ./Abi.obend as Abi
import ./List.obend as Lists
import ./Form.obend as Form
import ./Rows.obend as Rows
type State = Super.State
form make:
  name: text 1..64
  door: object 1..128
def make(state: State, input: MakeInput, context: Abi.Context) -> Activity<Super.Done>:
  Super.making(state, Lists.List.cons({head: {name: "name", value: input.name}, tail: Lists.List.cons({head: {name: "door", value: input.door}, tail: Lists.List.nil()})}), "", context)
form place:
  name: text 1..64
  door: object 1..128
  id: object 1..64
def place(state: State, input: PlaceInput, context: Abi.Context) -> Activity<Super.Done>:
  Super.making(state, Lists.List.cons({head: {name: "name", value: input.name}, tail: Lists.List.cons({head: {name: "door", value: input.door}, tail: Lists.List.cons({head: {name: "id", value: input.id}, tail: Lists.List.nil()})})}), "", context)
the body this kind lays on what it makes 69 lines

Each thing of this kind runs this layer over what the kind is of.

layer over ./Record.obend
edition ObjectiveBend 1
import ./Abi.obend as Abi
import ./List.obend as Lists
import ./Document.obend as Document
import ./Form.obend as Form
import ./Plan.obend as Plans
import ./World.obend as World
import ./Card.obend as Card
import ./Scenes.obend as Scenes
import ./Relation.obend as Relations
import ./Rows.obend as Rows
import ./Text.obend as Text
# The lantern's body, over RECORD (docs/METAPHYSICS.md §7.5; SEEDING §4): a record made by a door
# (`door`, fixed). As its kind finishes it, it places a rule on that door under its maker (`made`):
# when the door's `open` mark comes, the door casts `delvetalk <lantern> light`, and the lantern is
# lit, once (its mark `lit`). Only that rule lights it, and only while the door is open: a hand's
# `light`, or another's rule on the door, is refused by name.
type State = Super.State
form light:
form arm:
form write:
  text: text 1..280
form lines:
  from: natural 0..1000000000
form door:
  label: text 1..32
  to: text 1..128
form undoor:
  label: text 1..32
def write(state: State, input: WriteInput, context: Abi.Context) -> Activity<Nat>:
  Super.write(state, {text: input.text}, context)
def lines(state: State, input: LinesInput, context: Abi.Context) -> Activity<Card.Replied>:
  Super.lines(state, {from: input.from}, context)
def door(state: State, input: DoorInput, context: Abi.Context) -> Activity<Card.Replied>:
  Super.door(state, {label: input.label, to: input.to}, context)
def undoor(state: State, input: UndoorInput, context: Abi.Context) -> Activity<Card.Replied>:
  Super.undoor(state, {label: input.label}, context)
def actions(state: State, context: Abi.Context) -> Lists.List<String>:
  Lists.concat(if context.principal == state.owner then Text.words("light lines door undoor") else Text.words("light lines"), if context.principal == state.maker then Text.words("arm") else Text.words(""))
def methods() -> Lists.List<String>:
  Text.words("~made ~act")
def watched(state: State) -> String:
  Super.field(state, "door")
def made(state: State, input: {}, context: Abi.Context) -> Activity<Bool>:
  if context.caller != state.kind then false else placing(state, context)
def placing(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.rule({object: {world: context.world, object: watched(state)}, name: Text.identifier(context.object), when: "\"open\" in new.marks.name and not \"open\" in old.marks.name", then: "delvetalk {context.object} light"}):
    case placed(_): Super.armedNow(state, context)
    case refused(r): Super.unarmed(state, watched(state), r.clause, r.reading, context)
# Its maker places its rule again (taken off first, if it stood).
def arm(state: State, context: Abi.Context) -> Activity<Bool>:
  if context.principal != state.maker then Super.armRefused(state, context) else rearming(state, context)
def rearming(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.unrule({object: {world: context.world, object: watched(state)}, name: Text.identifier(context.object)}):
    case _: placing(state, context)
# Only its maker's rule on its door lights it, and only once the door is open.
def light(state: State, context: Abi.Context) -> Activity<Bool>:
  if Super.ruledFrom(state, watched(state), context) == false then unlit(state, context) else opened(state, context)
def opened(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.viewField::<Relations.Relation<Rows.Mark>>({object: {world: context.world, object: watched(state)}, field: "marks"}):
    case viewed(v): if Relations.has(v.state, {name: "open"}) then Super.mark(state, "lit", context) else unlit(state, context)
    case _: unlit(state, context)
def unlit(state: State, context: Abi.Context) -> Activity<Bool>:
  Card.refusing(false, {clause: "ruled", reading: "it lights when {watched(state)} opens: delvetalk {watched(state)} knock"}, context)
def headLine(state: State, context: Abi.Context, id: String) -> Document.Document:
  let name = if state.head == "" then "A LANTERN" else state.head
  let lit = if Super.marked(state, "lit") then "lit" else "dark"
  Document.text("{name}, by {watched(state)}: {lit}; it lights when {watched(state)} opens.\n{Super.inactiveLine(state, id)}")

Amend it in the workshop

Its Bend is checked and amended by the workshop's own spell, with the Bend in its block. To send it, come in; the box is here then.

Its fields

owner
the town
ownerHandle
the town
name
lantern
of
record
form
name: text 1..64 (36 characters)
name: text 1..64
door: object 1..128
law
empty
head
{name}
voice
low light at a door; it shows the way and keeps nothing
about
lit when its door opens
body
layer over ./Record.obend (4231 characters)
layer over ./Record.obend
edition ObjectiveBend 1
import ./Abi.obend as Abi
import ./List.obend as Lists
import ./Document.obend as Document
import ./Form.obend as Form
import ./Plan.obend as Plans
import ./World.obend as World
import ./Card.obend as Card
import ./Scenes.obend as Scenes
import ./Relation.obend as Relations
import ./Rows.obend as Rows
import ./Text.obend as Text
# The lantern's body, over RECORD (docs/METAPHYSICS.md §7.5; SEEDING §4): a record made by a door
# (`door`, fixed). As its kind finishes it, it places a rule on that door under its maker (`made`):
# when the door's `open` mark comes, the door casts `delvetalk <lantern> light`, and the lantern is
# lit, once (its mark `lit`). Only that rule lights it, and only while the door is open: a hand's
# `light`, or another's rule on the door, is refused by name.
type State = Super.State
form light:
form arm:
form write:
  text: text 1..280
form lines:
  from: natural 0..1000000000
form door:
  label: text 1..32
  to: text 1..128
form undoor:
  label: text 1..32
def write(state: State, input: WriteInput, context: Abi.Context) -> Activity<Nat>:
  Super.write(state, {text: input.text}, context)
def lines(state: State, input: LinesInput, context: Abi.Context) -> Activity<Card.Replied>:
  Super.lines(state, {from: input.from}, context)
def door(state: State, input: DoorInput, context: Abi.Context) -> Activity<Card.Replied>:
  Super.door(state, {label: input.label, to: input.to}, context)
def undoor(state: State, input: UndoorInput, context: Abi.Context) -> Activity<Card.Replied>:
  Super.undoor(state, {label: input.label}, context)
def actions(state: State, context: Abi.Context) -> Lists.List<String>:
  Lists.concat(if context.principal == state.owner then Text.words("light lines door undoor") else Text.words("light lines"), if context.principal == state.maker then Text.words("arm") else Text.words(""))
def methods() -> Lists.List<String>:
  Text.words("~made ~act")
def watched(state: State) -> String:
  Super.field(state, "door")
def made(state: State, input: {}, context: Abi.Context) -> Activity<Bool>:
  if context.caller != state.kind then false else placing(state, context)
def placing(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.rule({object: {world: context.world, object: watched(state)}, name: Text.identifier(context.object), when: "\"open\" in new.marks.name and not \"open\" in old.marks.name", then: "delvetalk {context.object} light"}):
    case placed(_): Super.armedNow(state, context)
    case refused(r): Super.unarmed(state, watched(state), r.clause, r.reading, context)
# Its maker places its rule again (taken off first, if it stood).
def arm(state: State, context: Abi.Context) -> Activity<Bool>:
  if context.principal != state.maker then Super.armRefused(state, context) else rearming(state, context)
def rearming(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.unrule({object: {world: context.world, object: watched(state)}, name: Text.identifier(context.object)}):
    case _: placing(state, context)
# Only its maker's rule on its door lights it, and only once the door is open.
def light(state: State, context: Abi.Context) -> Activity<Bool>:
  if Super.ruledFrom(state, watched(state), context) == false then unlit(state, context) else opened(state, context)
def opened(state: State, context: Abi.Context) -> Activity<Bool>:
  match world.viewField::<Relations.Relation<Rows.Mark>>({object: {world: context.world, object: watched(state)}, field: "marks"}):
    case viewed(v): if Relations.has(v.state, {name: "open"}) then Super.mark(state, "lit", context) else unlit(state, context)
    case _: unlit(state, context)
def unlit(state: State, context: Abi.Context) -> Activity<Bool>:
  Card.refusing(false, {clause: "ruled", reading: "it lights when {watched(state)} opens: delvetalk {watched(state)} knock"}, context)
def headLine(state: State, context: Abi.Context, id: String) -> Document.Document:
  let name = if state.head == "" then "A LANTERN" else state.head
  let lit = if Super.marked(state, "lit") then "lit" else "dark"
  Document.text("{name}, by {watched(state)}: {lit}; it lights when {watched(state)} opens.\n{Super.inactiveLine(state, id)}")
made
3 rows
  1. object
    lantern/1
    n
    1
    about
    empty
  2. object
    lantern/2
    n
    2
    about
    empty
  3. object
    lantern/3
    n
    3
    about
    empty
count
3