Inform 7 Home Page / Documentation
§13.15. Temporary relations
So far in this chapter, we've only seen relations which exist permanently during play. The relationships might change - sometimes Red Riding Hood would be in the Woodcutter's Cottage, sometimes not - but the relations themselves were eternal.
In fact, though, we can also create relations to be dynamic data structures, like lists:
let (a name not so far used) be (description of relations of values to values)
This phrase creates a new temporary variable, and sets its value to the identity of a newly created and equally temporary relation. These last only for the present block of phrases, which certainly means that they exist only in the current rule. Example:
This makes a purely temporary various-to-various relation between texts, which lasts as long as the temporary value "password dictionary" lasts. By default, relations are various-to-various, but we could instead write, say:
let the nicknames catalogue be a various-to-one relation of texts;
Such a relation exists only in the current phrase, and is destroyed when the phrase finishes, like any other "let". Of course there's no verb whose meaning is this relation, but that's no obstacle, because we can manipulate it using "relates":
now the nicknames catalogue relates "Trudy" to "Snake-eyes";
(At present such a relation cannot be used outside its own phrase.)