Previous: , Up: Usage   [Contents][Index]


4.5 Compile or Run Time

Normally, FoCus behaves dynamically, meaning that the translation to standard format calls occurs at run-time. This is the default behavior because it allows for maximum flexibility… and weirdness, admitedly, as the same call to FoCus’s format may behave differently if the current format table has changed in the meantime. The drawback of this approach, however, is that it induces a run-time overhead, which may become undesirable in format-intensive applications.

One way around this is to have your format table known at compile-time and instruct FoCus to perform a compile-time translation instead. This way, all dynamic trace of FoCus will disappear from your application. This can be done by setting the *compile* flag to a non-nil value (at compile-time of course!). By the way, this also explains why format is a macro instead of a regular function in FoCus.

When the flv extension is available (see Optional Features), this variable is automatically made file-local, and in-format-table sets it to t, so that you don’t have anything to do to switch to compile-time behavior. The demos/quotation library in the distribution provides an example of using FoCus in such a way.

Finally, when compile-time behavior is switched on, you may also use FoCus’s wrapper around the formatter macro.

Macro: formatter FORMAT-STRING

Wrapper around the standard FORMATTER macro.