bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] fatal: split: second argument is not an array


From: Hermann Peifer
Subject: Re: [bug-gawk] fatal: split: second argument is not an array
Date: Sun, 16 Mar 2014 03:44:08 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 2013-03-22 12:36, Hermann Peifer wrote:
On 2013-03-22 5:21, Aharon Robbins wrote:

I'm afraid you're misunderstanding. Any reference to a previously
non-existent element creates it *as a scalar* with an untyped value
(which
acts as the null string or zero). (...)
This is how awk has worked since The Beginning....


Hi Arnold,

Thanks for the explanations.

My thinking was...

I am coming back to an older mail about arrays of arrays. At the time, the issue was that I naively thought split("", a[1]) would force a[1] to be an array, similar to split("", b), which does exactly this for b. This is obviously not the case, as "Any reference to a previously non-existent element creates it *as a scalar*".

However: delete b[1] forces b[1] to be an array and maybe this could be mentioned at the end of doc section 8.6, as an alternative of forcing b[1] to be an array by creating an arbitrary index.

Maybe delete b[1] is even the better alternative as it creates an array with 0 elements and no arbitrary index can cause hiccups further down the road.

Hermann





reply via email to

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