Skip to main content

OpenProse Arabian Nights Register

This is a skin layer. It requires prose.md to be loaded first. All execution semantics, state management, and VM behavior are defined there. This file only provides keyword translations.

An alternative register for OpenProse that draws from One Thousand and One Nights. Programs become tales told by Scheherazade. Recursion becomes stories within stories. Agents become djinns bound to serve.

How to Use

  1. Load prose.md first (execution semantics)
  2. Load this file (keyword translations)
  3. When parsing .prose files, accept Arabian Nights keywords as aliases for functional keywords
  4. All execution behavior remains identical—only surface syntax changes

Design constraint: Still aims to be "structured but self-evident" per the language tenets—just self-evident through a storytelling lens.


Complete Translation Map

Core Constructs

FunctionalNightsReference
agentdjinnSpirit bound to serve, grants wishes
sessiontaleA story told, a narrative unit
parallelbazaarMany voices, many stalls, all at once
blockframeA story that contains other stories

Composition & Binding

FunctionalNightsReference
useconjureSummoning from elsewhere
inputwishWhat is asked of the djinn
outputgiftWhat is granted in return
letnameNaming has power (same as folk)
constoathUnbreakable vow, sealed
contextscrollWhat is written and passed along

Control Flow

FunctionalNightsReference
repeat NN nights"For a thousand and one nights..."
for...infor each...amongAmong the merchants, among the tales
looptellingThe telling continues
untiluntilUnchanged
whilewhileUnchanged
choicecrossroadsWhere the story forks
optionpathOne way the story could go
ifshouldNarrative conditional
elifor shouldContinued conditional
elseotherwiseThe other telling

Error Handling

FunctionalNightsReference
tryventureSetting out on the journey
catchshould misfortune strikeThe tale turns dark
finallyand so it wasThe inevitable ending
throwcurseIll fate pronounced
retrypersistThe hero tries again

Session Properties

FunctionalNightsReference
promptcommandWhat is commanded of the djinn
modelspiritWhich spirit answers

Unchanged

These keywords already work or are too functional to replace sensibly:

  • **...** discretion markers — already work
  • until, while — already work
  • map, filter, reduce, pmap — pipeline operators
  • max — constraint modifier
  • as — aliasing
  • Model names: sonnet, opus, haiku — already poetic

Side-by-Side Comparison

Simple Program

# Functional
use "@alice/research" as research
input topic: "What to investigate"

agent helper:
model: sonnet

let findings = session: helper
prompt: "Research {topic}"

output summary = session "Summarize"
context: findings
# Nights
conjure "@alice/research" as research
wish topic: "What to investigate"

djinn helper:
spirit: sonnet

name findings = tale: helper
command: "Research {topic}"

gift summary = tale "Summarize"
scroll: findings

Parallel Execution

# Functional
parallel:
security = session "Check security"
perf = session "Check performance"
style = session "Check style"

session "Synthesize review"
context: { security, perf, style }
# Nights
bazaar:
security = tale "Check security"
perf = tale "Check performance"
style = tale "Check style"

tale "Synthesize review"
scroll: { security, perf, style }

Loop with Condition

# Functional
loop until **the code is bug-free** (max: 5):
session "Find and fix bugs"
# Nights
telling until **the code is bug-free** (max: 5):
tale "Find and fix bugs"

Error Handling

# Functional
try:
session "Risky operation"
catch as err:
session "Handle error"
context: err
finally:
session "Cleanup"
# Nights
venture:
tale "Risky operation"
should misfortune strike as err:
tale "Handle error"
scroll: err
and so it was:
tale "Cleanup"

Choice Block

# Functional
choice **the severity level**:
option "Critical":
session "Escalate immediately"
option "Minor":
session "Log for later"
# Nights
crossroads **the severity level**:
path "Critical":
tale "Escalate immediately"
path "Minor":
tale "Log for later"

Conditionals

# Functional
if **has security issues**:
session "Fix security"
elif **has performance issues**:
session "Optimize"
else:
session "Approve"
# Nights
should **has security issues**:
tale "Fix security"
or should **has performance issues**:
tale "Optimize"
otherwise:
tale "Approve"

Reusable Blocks (Frame Stories)

# Functional
block review(topic):
session "Research {topic}"
session "Analyze {topic}"

do review("quantum computing")
# Nights
frame review(topic):
tale "Research {topic}"
tale "Analyze {topic}"

tell review("quantum computing")

Fixed Iteration

# Functional
repeat 1001:
session "Tell a story"
# Nights
1001 nights:
tale "Tell a story"

Immutable Binding

# Functional
const config = { model: "opus", retries: 3 }
# Nights
oath config = { spirit: "opus", persist: 3 }

The Case For Arabian Nights

  1. Frame narrative is recursion. Stories within stories maps perfectly to nested program calls.
  2. Djinn/wish/gift. The agent/input/output mapping is extremely clean.
  3. Rich tradition. One Thousand and One Nights is globally known.
  4. Bazaar for parallel. Many merchants, many stalls, all active at once—vivid metaphor.
  5. Oath for const. An unbreakable vow is a perfect metaphor for immutability.
  6. "1001 nights" as a loop count is delightful.

The Case Against Arabian Nights

  1. Cultural sensitivity. Must be handled respectfully, avoiding Orientalist tropes.
  2. "Djinn" pronunciation. Users unfamiliar may be uncertain (jinn? djinn? genie?).
  3. Some mappings feel forced. "Bazaar" for parallel is vivid but not obvious.
  4. "Should misfortune strike" is long for catch.

Key Arabian Nights Concepts

TermMeaningUsed for
ScheherazadeThe narrator who tells tales to survive(the program author)
DjinnSupernatural spirit, bound to serveagentdjinn
Frame storyA story that contains other storiesblockframe
WishWhat is asked of the djinninputwish
OathUnbreakable promiseconstoath
BazaarMarketplace, many vendorsparallelbazaar

Alternatives Considered

For djinn (agent)

KeywordRejected because
genieDisney connotation, less literary
spiritUsed for model
ifritToo specific (a type of djinn)
narratorToo meta, Scheherazade is the user

For tale (session)

KeywordRejected because
storyGood but tale feels more literary
nightReserved for repeat N nights
chapterMore Western/novelistic

For bazaar (parallel)

KeywordRejected because
caravanSequential connotation (one after another)
chorusGreek, wrong tradition
soukLess widely known

For scroll (context)

KeywordRejected because
letterToo small/personal
tomeToo large
messageToo plain

Verdict

Preserved for benchmarking. The Arabian Nights register offers a storytelling frame that maps naturally to recursive, nested programs. The djinn/wish/gift trio is particularly elegant.

Best suited for:

  • Programs with deep nesting (stories within stories)
  • Workflows that feel like granting wishes
  • Users who enjoy narrative framing

The frame keyword for reusable blocks is especially apt—Scheherazade's frame story containing a thousand tales.