bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Suggestion for Manual re: Sec. 2.5.2 The AWKLIBPATH Envir


From: arnold
Subject: Re: [bug-gawk] Suggestion for Manual re: Sec. 2.5.2 The AWKLIBPATH Environment Variable
Date: Sat, 20 Jan 2018 11:19:15 -0700
User-agent: Heirloom mailx 12.4 7/29/08

Hi.

Thanks for the note.

"Neil R. Ormos" <address@hidden> wrote:

> It appears that changing the value of
> ENVIRON["AWKLIBPATH"] while a gawk program is
> running does not have an effect on where gawk
> searches for extensions.
>
> I suggest a comment to this effect be placed in
> section 2.5.2.

Good idea.

> There is a comment in Sec. 2.5.1 explaining the
> analogous lack of effect of changing AWKPATH:
>
> |> Although you can change ENVIRON["AWKPATH"]
> |> within your awk program, this has no effect on
> |> the running program's behavior. This makes
> |> sense: the AWKPATH environment variable is used
> |> to find the program source files. Once your
> |> program is running, all the files have been
> |> found, and gawk no longer needs to use AWKPATH.
>
> although I'm not sure that the "this makes sense"
> rationale equally applies to AWKLIBPATH, since a
> user might conceivably seek to load an extension
> from a location not foreseen at the time gawk is
> invoked.

Gawk loads extensions before starting to run the program.
It's conceptually the same as reading multiple files specified
via multiple -f options on the command line; the entire
program has to be loaded before it can be run.

Similarly, extensions need to be loaded before running;
when gawk parses a function call, for example, it doesn't
know where that function is defined: it might be in awk
code later in the program or an extension function.

In short, dynamically loading extensions once a gawk program
is executing would be a huge mess.

Thanks,

Arnold



reply via email to

[Prev in Thread] Current Thread [Next in Thread]