[Top][All Lists]

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

Re: [bug-gawk] Access variables not conforming to the variable naming co

From: arnold
Subject: Re: [bug-gawk] Access variables not conforming to the variable naming convention?
Date: Mon, 03 Dec 2018 09:12:20 -0700
User-agent: Heirloom mailx 12.5 7/5/10

"Andrew J. Schorr" <address@hidden> wrote:

> > > Are you disabling that ability to create the variable by poking it into 
> > > SYMTAB
> > 
> > **** THERE IS NO SUCH CAPABILITY ****.  The fact that you reference 'age'
> > in the program is what puts it into SYMTAB.
> Ah, OK, thanks for clarifying.
> > Your program creates unrelated (non-variable) elements in SYMTAB "name"
> > and "weight" that are no different from any other array elements.
> But with your proposed patch, this program will give a fatal error,
> won't it?

Yes.  I think that's an improvement, because people are also
confused by

        SYMTAB["a var"] = 42

> > It is exactly this confusion that I'm trying to avoid.
> I guess there's a question as to whether this is progress or just breaks
> sloppy code.

Let's break sloppy code!

> As I said, I don't like this paradigm because it stomps
> on the variable namespace, but I suppose others may be using it...

How does it stomp on the variable namespace?  It merely misuses
SYMTAB. It's not any different than

        NR == 1 {
                for (i = 1; i <= NF; i++)
                        PROCINFO[$i] = 0

You can certainly do that, but it's not what PROCINFO was meant for.

In any case, the code is already in master. It'll take a very convincing
argument to get me to undo it; I had misgvings when I first implemented
SYMTAB about doing it the way I did; expreience has shown that those misgivings 
were real.



reply via email to

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