bug-gawk
[Top][All Lists]
Advanced

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

Re: unassigned/untyped behaviour


From: Andrew J. Schorr
Subject: Re: unassigned/untyped behaviour
Date: Tue, 21 Nov 2023 16:05:00 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Tue, Nov 21, 2023 at 12:32:58PM -0700, arnold@skeeve.com wrote:
> Andy, I have a favor to ask. Please don't send these small test programs
> as long one-liners; they become harder to copy/paste that way.

Oops, sorry about that. I had thought it was simpler to copy and paste
a single line, but if your mail program wraps the line, I guess it could
be a problem.

> >           For example:
> >
> >                BEGIN {
> >                    # creates a[1] but it has no assigned value
> >                    a[1]
> >                    print typeof(a[1])  # unassigned
> >                }
> >
> > But in fact, that's not what the master branch produces:
> 
> That example is bad. I will fix the doc.

On 2nd thought, I don't understand why the doc is wrong. Doesn't the statement
"a[1]" actually instantiate a[1] as an unassigned scalar value? In other words,
is it proper to do this?

gawk 'BEGIN {a[0]; a[0][1] = 5; print a[0][1]}'

This currently works in the master branch. Why is that OK?
Or is that not really OK but too hard to fix?

Thanks,
Andy



reply via email to

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