A quotation is an anonymous colon definition inside another colon
definition. Quotations are useful when dealing with words that
consume an execution token, like catch or
outfile-execute. E.g. consider the following example of using
outfile-execute (see Redirection):
: some-warning ( n -- ) cr ." warning# " . ; : print-some-warning ( n -- ) ['] some-warning stderr outfile-execute ;
Here we defined some-warning as a helper word whose xt we could
pass to outfile-execute. Instead, we can use a quotation to define
such a word anonymously inside print-some-warning:
The quotation is bounded by [: and ;]. It produces an
execution token at run-time.
Starts a quotation in the next section.
Ends a quotation (represented by xt) and switch to the
previous section. Latestxt and latestnt refer to
the last word in the current section, i.e., not to the
quotation.