[Top][All Lists]

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

Re: [bug-gawk] On uninitialized variables

From: arnold
Subject: Re: [bug-gawk] On uninitialized variables
Date: Tue, 14 May 2019 05:26:35 -0600
User-agent: Heirloom mailx 12.5 7/5/10

M <address@hidden> wrote:

> After rereading the manual and having some tests, I finally found the answer 
> to my first question. There's no trouble.
> Two questions are still actual. I'll formulate them here.
> 1. According to the manual (9.1.7 Getting Type Information):
> "unassigned - x is a scalar variable that has not been assigned a value yet."
> "And in fact, due to the way gawk works,
> if you pass the name of a variable that has not been previously used to 
> isarray(),
> gawk ends up turning it into a scalar."
> But the result of "typeof" function after passing a variable to isarray() is:
> $ gawk 'BEGIN { if (! isarray(x)) { print typeof(x) } }'
> untyped
> Not "unassigned". Why? Is it a bug?

A bug in the manual. I will tend to it.

> 2. The last sentence of the section "9.1.7 Getting Type Information" is:
> "The typeof() function is general; it allows you to determine
> if a variable or function parameter is a scalar, an array, or a strongly 
> typed regexp."
> A strongly typed regexp is a sort of scalar, isn't it?

In the sense that it's not an array, yes.

> I don't understand why it is mentioned separately in this sentence.

Because gawk groups 42 and "forty-two" together as scalars,
distinguished from @/42/.



reply via email to

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