[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 06:35:08 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
M <address@hidden> wrote:
> 1. OK.
>
> 2. What does it mean "groups together"? They all have different types:
> "number", string" and "regexp" accordingly.
My bad. (I'm too tired to be doing this...)
> _______________
>
> Yours respectfully,
> Mark Krauze
>
> 14.05.2019, 14:26, "address@hidden" <address@hidden>:
> > 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/.
> >
> > HTH,
> >
> > Arnold
- [bug-gawk] On uninitialized variables, M, 2019/05/12
- Re: [bug-gawk] On uninitialized variables, arnold, 2019/05/13
- Re: [bug-gawk] On uninitialized variables, M, 2019/05/13
- Re: [bug-gawk] On uninitialized variables, M, 2019/05/13
- Re: [bug-gawk] On uninitialized variables, M, 2019/05/14
- Re: [bug-gawk] On uninitialized variables, arnold, 2019/05/14
- Re: [bug-gawk] On uninitialized variables, M, 2019/05/14
- Re: [bug-gawk] On uninitialized variables,
arnold <=
- Re: [bug-gawk] On uninitialized variables, M, 2019/05/21
Re: [bug-gawk] On uninitialized variables, Manuel Collado, 2019/05/14