Relationship
Stable — Stable features are ones that have earned their place in the core prose language.
universe ClockworkVillage {
describe { ... }
}
dimension place { describe { ... } }
dimension thing { describe { ... } }
relationship isNextTo {
describe {
Places can be next to other places.
}
}
relationship sitsOn and isSatOnBy {
describe {
Villagers can sit on benches to rest and chat with other villagers.
}
}
concept Villager {
describe { ... }
}
place Well {
describe { ... }
thing WellRope {
describe { ... }
}
}
place Pond {
describe {
The pond is where the villagers fish and relax.
}
}
place Bench {
describe {
A bench the villagers can sit on and rest.
}
}
What it is
A word for how two things connect. Declaring a relationship only names the word — it does not connect anything yet. That comes next.
One name is enough when both sides would say the same thing. A bench next to a pond, and a pond next to a bench, is the same sentence read from either end, so isNextTo stands alone.
Two names joined with and when each side has its own word. A villager sits on a bench; the bench is sat on by the villager. Those are different sentences, so the relationship carries both: sitsOn and isSatOnBy.
The words are lowercase, like dimensions, because a connection is a kind of thing rather than a named one.
Each side, separately
Experimental. A describe on the relationship covers the pair. When the two words carry genuinely different meaning, each one can also be spoken about on its own, in a block named after it.
universe ClockworkVillage { }
dimension orientation {
describe {
Which way a sequence runs.
}
}
orientation Advancing { }
relationship indicates and isIndicatedBy { }
relationship follows and isFollowedBy {
describe {
Each thing follows the one before it.
}
isFollowedBy {
describe {
Read forward: what comes next.
}
relationships {
indicates { Advancing }
}
}
}
A side block accepts a describe and a relationships block, and nothing else. There is no keyword for it — the block's name is one of the two words, so nothing new had to be invented.
Advancing here is an ordinary concept in this universe, not something the language knows about. Prose gives the fact somewhere to live and stays silent about what it means; whether anything acts on it is up to whatever reads the manifest.
A relationship may also carry a relationships block of its own, describing the pair rather than a side. That previously parsed and was silently thrown away, so a universe that wrote one will now see it take effect.
A side speaks for its word everywhere the word is used. To say something about one connection rather than about the word, put the sentence on that connection instead. Relationships shows how, under Each edge, separately.
Where it can live
Anywhere. At file scope for words the whole village shares, or inside a concept or a dimension when the word only makes sense there.
Where it sits decides who can use it. A relationship declared on a dimension is available to every concept of that kind, and nowhere else.
A side block lives inside the relationship that declared the word, and only there. A side is not a name the rest of the universe can point at, which is why nothing else in the world can mention one.
A relationship body itself holds only facts about the relationship and its sides — a describe, a title, a relationships block, and side blocks. A concept or a pairing declared in here is refused, because there is nowhere for it to go.
How names find it
A relationship word has to be in reach where it is used — declared on that scope or on one above it.
Like a dimension, a relationship word cannot be redeclared further down its own scope chain. Two declarations of the same word in one chain would be two different relationships wearing one name.
Two separate branches may each have their own follows without conflict. They are not hiding each other, because neither is in the other's chain.
When two kinds each declare the same paired word but disagree about the partner, there is no single fact to record. The language refuses rather than picking a side.
A side block has to name one of the two words this relationship declared. Any other name is refused rather than read as a new declaration, because a relationship body holds facts about that relationship and its sides, and nothing else lives there.
For the same reason, a relationship word may not be describe, title or relationships. Each of those already means something inside a relationship body, and a word that shadowed one would make it unreachable — the same rule that stops a dimension or a relationship being redeclared down its own scope chain.
How it breaks
- SP005
DisallowedKindError— Some blocks only allow certain kinds of declaration. - SP012
RelationshipAlreadyExistsError— That relationship word is already taken in this scope. - SP023
RelationshipPairConflictError— Both sides of a connection define the same word with different partners. - SP025
RelationshipAlreadyDeclaredInChainError— A relationship word cannot be redeclared down its own scope chain. - SP027
ReservedRelationshipNameError— A relationship word cannot be describe, title, or relationships, because a block by that name is already meaningful inside a relationship. - SP028
SideNotInRelationshipError— A block inside a relationship may only describe a side that relationship declared.
Decided in
- ADR003
EndpointDimensionPairs— Endpoint dimension relationship pairs. Accepted. - ADR007
RelatesEndpointDimensionPairs— Relates endpoint dimension pairs. Accepted. - ADR008
RelationshipChainUniqueness— Relationship chain uniqueness. Accepted. - ADR012
FileScopeUniverse— File-scope universe. Accepted. - ADR025
RelationshipSideBlocks— Relationship side blocks. Accepted.