[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Another typeof() issue
From: |
arnold |
Subject: |
Re: [bug-gawk] Another typeof() issue |
Date: |
Sun, 28 Jun 2015 23:07:13 -0600 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
Hi.
Interesting test cases. "strnum" should probably be renamed
"userdata"; it means that the data came from the user and if it
looks numeric should be treated as such in a comparison.
The output from the debugger is also interesting. Gawk occasionally
behaves differently under the debugger even though it shouldn't. I'll
take a look.
I'm starting to wonder if I shouldn't revert these new features.
Thanks,
Arnold
Hermann Peifer <address@hidden> wrote:
> >> Maybe typeof() could also indicate if the variable has the strnum type,
> >> as explained in the manual: 6.3.2.1 String Type versus Numeric Type
> >>
> >> Hermann
> >
> > This is a nice thought. It's on my todo list, I hope by end of day today.
> >
>
> Thanks for taking care. When looking at fields, the results of typeof()
> are somewhat different to my expectations, but maybe these are wrong (?).
>
> Hermann
>
> $ echo "abc 123" > data
> $ echo '{print typeof($1), typeof($2)}' > test.awk
>
> # Expected types: string strnum
> $ awk -f test.awk data
> strnum strnum
>
> # Debugging returns the opposite of the expected results
> $ printf 'w $1 \n w $2 \n r \n n \n n' | awk -D -f test.awk data
> Watchpoint 1: $1
> Watchpoint 2: $2
> Starting program:
> Stopping in Rule ...
> Watchpoint 1: $1
> Old value: ""
> New value: "abc"
> main() at `test.awk':1
> 1 {print typeof($1), typeof($2)}
> Watchpoint 2: $2
> Old value: ""
> New value: "123"
> main() at `test.awk':1
> 1 {print typeof($1), typeof($2)}
> strnum string # ???
- [bug-gawk] Another typeof() issue, Hermann Peifer, 2015/06/22
- Re: [bug-gawk] Another typeof() issue, Aharon Robbins, 2015/06/22
- Re: [bug-gawk] Another typeof() issue, Hermann Peifer, 2015/06/22
- Re: [bug-gawk] Another typeof() issue, Hermann Peifer, 2015/06/23
- Re: [bug-gawk] Another typeof() issue, Aharon Robbins, 2015/06/26
- Re: [bug-gawk] Another typeof() issue, Hermann Peifer, 2015/06/28
- Re: [bug-gawk] Another typeof() issue,
arnold <=
- Re: [bug-gawk] Another typeof() issue, Hermann Peifer, 2015/06/29
- Re: [bug-gawk] Another typeof() issue, Aharon Robbins, 2015/06/29
- Re: [bug-gawk] Another typeof() issue, Hermann Peifer, 2015/06/29
- Re: [bug-gawk] Another typeof() issue, Andrew J. Schorr, 2015/06/29
- Re: [bug-gawk] Another typeof() issue, Aharon Robbins, 2015/06/29
- Re: [bug-gawk] Another typeof() issue, Aharon Robbins, 2015/06/29
- Re: [bug-gawk] Another typeof() issue, Hermann Peifer, 2015/06/30