bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] array initialization


From: Wolfgang Laun
Subject: Re: [bug-gawk] array initialization
Date: Sat, 5 Jan 2019 09:57:56 +0100

IMH, it would be preferable if you can avoid burdening the user with
thinking about getting some optimum _implementation._

Idea: whenever the last element of an array is deleted, revert its type to
"null". The element added next will select the new type.

-W

On Fri, 4 Jan 2019 at 23:50, Andrew J. Schorr <
address@hidden> wrote:

> On Fri, Jan 04, 2019 at 05:28:02PM -0500, Andrew J. Schorr wrote:
> > Based on some debugging, I believe one can actually get a "null"
> (typeless) array
> > like so:
> >    split("", y)
>
> Well, oops, this approach doesn't seem to work for subarrays:
>
> bash-4.2$ ./gawk 'BEGIN {split("", y[1]); print isarray(y)}'
> gawk: cmd. line:1: fatal: split: second argument is not an array
>
> So using "split" does not seem to work in the general case.
>
> Is there a way to do this properly? This two-step process seems to work:
>    y[1][1] = 0
>    split("", y[1])
> But that's rather cumbersome...
>
> Regards,
> Andy
>
>


reply via email to

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