[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] typeof() array subscripts
From: |
arnold |
Subject: |
Re: [bug-gawk] typeof() array subscripts |
Date: |
Sun, 21 Jun 2015 08:22:51 -0600 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
"Andrew J. Schorr" <address@hidden> wrote:
> On Sun, Jun 21, 2015 at 01:52:46PM +0200, Hermann Peifer wrote:
> > Do I also see it right that typeof()'s "untyped" actually means "untyped
> > scalar" whereas the debugger's "untyped variable" is a different animal, as
> > it can turn into an array?
>
> That appears to be the case:
>
> bash-4.2$ gawk 'BEGIN {print typeof(x)}'
> untyped
> bash-4.2$ gawk 'BEGIN {print typeof(x); x[1] = 3; print typeof(x)}'
> untyped
> gawk: cmd. line:1: fatal: attempt to use scalar `x' as an array
>
> It seems that the act of passing 'x' to typeof is instantiating it
> as a scalar. The act of inspecting it changes the result, unfortunately.
This is a bug that I thought I had handled; typeof should not be forcing
the parameter to scalar. I will look at this.
Thanks,
Arnold