[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gawk-5.2.2: fatal: attempt to use scalar parameter `a' as an array
From: |
arnold |
Subject: |
Re: gawk-5.2.2: fatal: attempt to use scalar parameter `a' as an array |
Date: |
Mon, 05 Jun 2023 06:02:18 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
"Rajeev V. Pillai" <rajeev_v_pillai@yahoo.com> wrote:
> On Sunday, 4 June 2023 at 13:44:50 UTC, arnold@skeeve.com
> <arnold@skeeve.com> wrote:
>
> > When length() is called on an untyped variable, said untyped variable is
> > coerced into being a scalar, since that is historical practice in awk.
> > Then:
> >
> > a[++n] = s
> >
> > tries to treat 'a' as an array, and gawk generates the fatal message.
> > [...]
> > I hope this explanation clarifies the behavior for you.
>
> Thanks for the explanation; I had come to much the same conclusion myself,
> but,
> onetrueawk coerces `A' into an array type--according to the `-d' output. Does
> this
> mean it isn't POSIX-compliant in this regard?
>
> -RVP
POSIX doesn't really specify the behavior here. It's a legitimate implementation
difference.
Arnold