Namespace Summary (The GNU Awk User’s Guide)

From Get docs
Gawk/docs/latest/Namespace-Summary


15.9 Summary

  • Standard awk provides a single namespace for all global identifiers (scalars, arrays, and functions). This is limiting when one wants to develop libraries of reusable functions or function suites.
  • gawk provides multiple namespaces by using qualified names: names consisting of a namespace name, a double colon, ::, and a component name. Namespace names might still possibly conflict, but this is true of any language providing namespaces, modules, or packages.
  • The default namespace is awk. The rules for namespace and component names are provided in Namespace and Component Naming Rules. The rules are designed in such a way as to make namespace-aware code continue to look and work naturally while still providing the necessary power and flexibility.
  • Other parts of gawk have been extended as necessary to integrate namespaces smoothly with their operation. This applies most notably to the profiler / pretty-printer (see section Profiling Your awk Programs) and to the extension facility (see section Writing Extensions for gawk).
  • Overall, the namespace facility was designed and implemented such that backwards compatibility is paramount. Programs that don’t use namespaces should see absolutely no difference in behavior when run by a namespace-capable version of gawk.