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: Wed, 22 Nov 2023 10:30:27 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Wed, Nov 22, 2023 at 08:00:19AM -0700, arnold@skeeve.com wrote:
> > In section 8.1.2, "Referring to an Array Element", it says:
> >
> > https://www.gnu.org/software/gawk/manual/html_node/Reference-to-Elements.html
> >
> > "A reference to an array element that has no recorded value yields a
> > value of "", the null string. This includes elements that have not been
> > assigned any value as well as elements that have been deleted (see The
> > delete Statement).
> > 
> > NOTE: A reference to an element that does not exist automatically creates
> > that array element, with the null string as its value. (In some cases,
> > this is unfortunate, because it might waste memory inside awk.)"
> >
> > So is that wrong?
> 
> It used to be exactly correct. Now, well, let's say it's a simplification
> that applies to most use cases.  The association of the null string as
> the value simply happens later, as soon as the value is needed, instead of
> happening when the element is created.
> 
> Does that help?

To be clear, I'm OK with this new behavior. But I do think the documentation
needs to be modified to reflect this new approach. The docs have not
kept pace, but overall, the ability to have the ability to create subarrays
later is a big win. I think we just want to be clear about how this
is all supposed to work.

Thanks,
Andy



reply via email to

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