bug-gawk
[Top][All Lists]
Advanced

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

Re: indirect function call issues (2)


From: arnold
Subject: Re: indirect function call issues (2)
Date: Thu, 16 Jan 2025 00:47:34 -0700
User-agent: Heirloom mailx 12.5 7/5/10

Denis Shirokov <cosmogen@gmail.com> wrote:

> Another question on a completely different topic — look:
>
> Example:
>
> BEGIN {
>     length(A[1])
>     print "A[1] : " typeof(A[1])
>
>     length(B)
>     print "B : " typeof(B)
> }
>
> Outputs:
>
>
> A[1] : untyped  B : unassigned
>
> In the first case, length() does not make A[1] a string or an array,
> leaving A[1] in the *untyped* state, whereas in the second case, for some
> reason, it makes the neutral B *unassigned*. Is this correct in light of
> the new (but long-awaited!) gawk feature allowing uninitialized subscripts
> in arrays without automatically making them *unassigned*?
>
> Is such behavior correct?

This is correct. It's an issue of historical compatibility, where
length() has always converted an untyped variable into a scalar.

Arnold



reply via email to

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