Next: , Previous: , Up: Namespaces   [Contents][Index]


15.6 Internal Name Management

For backwards compatibility, all identifiers in the awk namespace are stored internally as unadorned identifiers (that is, without a leading ‘awk::’). This is mainly relevant when using such identifiers as indices for SYMTAB, FUNCTAB, and PROCINFO["identifiers"] (see section Built-in Variables That Convey Information), and for use in indirect function calls (see section Indirect Function Calls).

In program code, to refer to variables and functions in the awk namespace from another namespace, you must still use the ‘awk::’ prefix. For example:

@namespace "awk"          This is the default namespace

BEGIN {
    Title = "My Report"   Qualified name is awk::Title
}

@namespace "report"       Now in report namespace

function compute()        This is really report::compute()
{
    print awk::Title      But would be SYMTAB["Title"]
    …
}