Continuing a discussion from here.
Inform 7 allows a game to understand things by properties–you can say that a block can have a color (red, green, or blue), say “Understand the color property as describing a block” and then the game will understand “RED BLOCK” as a red block if and only if the color of the block is red–so when the color changes the way it can be understood changes.
But what about dynamically generated descriptions that go beyond colors? My “game” Garbage Collection generates a series of random descriptions of garbage:
Not every word generated here is a property of the piece of garbage in a straightforward way (source code is here) and in any case it might be nice to just have the parser automatically understand the string generated for the piece of garbage as referring to it. So if these five pieces of garbage were generated, it would understand the difference between “x purple film” and “x cracked metal” and “x smooth metal” etc.
This might, for instance, help us simulate a gigantic heap of garbage with only a few objects–have a few objects representing pieces of object defined in the code, and assign them new descriptions as new pieces of garbage are drawn from the pile while old ones are returned to it.
The virtual machines that Inform compiles to don’t do this easily (as far as I know)–they rely on dictionary words that are generated at compile time, which are assigned to objects… well, somehow (won’t pretend I understand the parser)… there’s a sort of pre-parser or something that resolves a command into dictionary words and non-dictionary text, and as the parser processes dictionary words it looks around to see what objects the words might match.
How might we make a system that’s more friendly to dynamic parsing in this way? Well, it seems to me that one way might be to flip the order. Instead of having the parser understand words and find objects to match them, have the underlying machine assign words to objects. Then a pre-parser could figure out what objects are available for reference at any given time, and what words refer to them, and the parser could check if the words in the command match the words that refer to the available objects.
That would make it easier to the sort of generation I described–just change the list of words associated with an object. It could even happen with words that themselves were generated, so you could generate random names like “huwikaz” and “zucimut” and assign them to objects.
I mentioned some of these ideas here, but the context was “How can I actually do this?” rather than “How can I describe a system I’d like someone else to write?”