Req: (print exact words $Words)


I’m wary of this, because it could easily lead to inefficient code. Dialog dictionary words are primarily designed to represent player input, and can sometimes also work as simple printable constants (e.g. when they are used to name actions). They are case insensitive, because player input is always converted to lower case anyway. But they aren’t intended for representing output text, and the runtime just isn’t designed for passing large chunks of text around.

I’m not saying that it would be impossible to add such a feature. One way would be to add special words: Just like (get key $) can return special words for e.g. the cursor keys, one could add special words for (space), (no space), (uppercase), and so on. These could be inserted into the list generated by (collect words), so that e.g. “Hello, XYZ” would come out as [<uppercase> hello , <uppercase> X <nospace> <uppercase> Y <nospace> <uppercase> Z]. And printing the special words could be made to reproduce the desired behaviour.

But besides the performance issue, there’s also the matter of side-effects. Suppose you have the following (contrived) code:

(narrate age of bob)
                with youthful enthusiasm
                in a jaded manner
                , by now a mere shadow of his former self

(beat #my-quip)
        Bob clears his throat (narrate age of bob).

(nag #my-quip)
        Well, what's your answer, inquires Bob (narrate age of bob).

If you first evaluate (nag $) and store the text in a variable, and then evaluate (beat $), then the output from “beat” describes an older Bob than the stored text.

Could you implement the desired functionality with closures instead, somehow? It would result in better performance, and preserve the relative order of output text and side-effects.