Next: , Previous: , Up: Advanced Features of gawk   [Contents][Index]


12.8 Builtin Features versus Extensions

As this and subsequent chapters show, gawk has a large number of extensions over standard awk built-in to the program. These have developed over time. More recently, the focus has moved to using the extension mechanism (see Writing Extensions for gawk) for adding features. This section discusses the “guiding philosophy” behind what should be added to the interpreter as a built-in feature versus what should be done in extensions.

There are several goals:

  1. Keep the language awk; it should not become unrecognizable, even if programs in it will only run on gawk.
  2. Keep the core from getting any larger unless absolutely necessary.
  3. Add new functionality either in awk scripts (-f, @include) or in loadable extensions written in C or C++ (-l, @load).
  4. Extend the core interpreter only if some feature is:
    1. Truly desirable.
    2. Cannot be done via library files or loadable extensions.
    3. Can be implemented without too much pain in the core.

Combining modules with awk files is a powerful technique. Some of the sample extensions demonstrate this.

Loading extensions and library files should not be done automatically, because then there’s overhead that most users don’t want or need.