15.8 Namespaces and Other gawk Features

This section looks briefly at how the namespace facility interacts with other important gawk features.

The profiler and pretty-printer (see Profiling Your awk Programs) have been enhanced to understand namespaces and the namespace naming rules presented in Namespace and Component Naming Rules. In particular, the output groups functions in the same namespace together, and has @namespace directives in front of rules as necessary. This allows component names to be simple identifiers, instead of using qualified identifiers everywhere.

Interaction with the debugger (see Introduction to the gawk Debugger) has not had to change (at least as of this writing). Some of the internal byte codes changed in order to accommodate namespaces, and the debugger’s dump command was adjusted to match.

The extension API (see Writing Extensions for gawk) has always allowed for placing functions into a different namespace, although this was not previously implemented. However, the symbol lookup and symbol update routines did not have provision for including a namespace. That has now been corrected (see Variable Access and Update by Name). See Enabling In-Place File Editing, for a nice example of an extension that leverages a namespace shared by cooperating awk and C code.