bug-gawk
[Top][All Lists]
Advanced

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

Re: built-in functions are missed in non-awk namespaces


From: Denis Shirokov
Subject: Re: built-in functions are missed in non-awk namespaces
Date: Thu, 1 Aug 2024 13:42:24 +0300

...regarding whether @include would preserve the current namespace:

Just had a thought: what if in each namespace we do an Include with a
description of some basic functions, needed just for general operation.
Something like

func _a( a,b,c,d ) {
return a }

func _b( a,b,c,d ) {
return b }

func _print( t ) {
print t :}

and so on ...

Turns out, it won't work. You can only include a file once. Wait a minute!
What if we add a space to the name of the included file? Wow! Its works.
But how am I supposed to know how many spaces to add? .. Hmm. I think each
library should have its own number of spaces when a file @including

Forgive me, that's just my sense of humor :)

with Respect
Denis)

вт, 30 июл. 2024 г. в 19:43, <arnold@skeeve.com>:

> Denis Shirokov <cosmogen@gmail.com> wrote:
>
> >   One more question - I don’t see any information about this in the
> > documentation:
> > What is the initial namespace inside a file when it is @include - the
> > current one (the one from which the @include was made) or always awk?
>
> It is documented, see
> https://www.gnu.org/software/gawk/manual/gawk.html#Changing-The-Namespace.
>
> > Right now, I see that it is always awk namespace at the beginin of fuke
> > included. Is this correct?
>
> Yes.
>
> >  Perhaps it would be more convenient if the namespace remained current -
> > the one from which the @include itself was made.
>
> This has it's advantages and disadvantages. The main disadvantage is
> that making this change would break existing programs.  It might have
> been better to do things the other way, but it's too late now. :-(
>
> Thanks,
>
> Arnold
>


reply via email to

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