bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gawk's PROCINFO["identifiers"] fails to report type


From: David Kaspar [Dee'Kej]
Subject: Re: [bug-gawk] gawk's PROCINFO["identifiers"] fails to report type
Date: Tue, 18 Jul 2017 13:15:18 +0200

Hello Peter,

based on the feedback from guys here, the fact that the next gawk release is yet to come, and the fact we have already released F26 few days ago, I don't see it possible for next release to make it into Fedora sooner than in F27.

And backporting this functionality into F25 is not worth the effort/time for me (I need to focus on more important things). I'm sorry to disappoint, but if you would like to backport the functionality into F25 however, feel free to send me the patch and I will consider it for F26. ;)

Best regards,

David Kaspar [Dee'Kej]
Associate Software Engineer

Brno, Czech Republic


RED HAT | TRIED. TESTED. TRUSTED.
Every airline in the Fortune 500 relies on Red Hat.
Find out why at Trusted | Red Hat.

On Mon, Jul 17, 2017 at 7:47 PM, <address@hidden> wrote:
Manuel is correct. Awk is a dynamic language and its possible for
the same identifier to morph at runtime into either a scalar or
an array.

It might be possible to do a little bit stronger typing during parsing,
but I think it'd be risky and likely to break things.

I'm not up to adding full dataflow analysis to gawk, nor do I think it'd
be worth the trouble.

Thanks,

Arnold

Manuel Collado <address@hidden> wrote:

> What you want, i.e. to have the current type information at run-time,
> will be available in the next gawk release as a builtin typeof(variable)
> function. Please build from the master GIT sources to test it.
>
> The current gawk-4.1.4 only has an isarray(variable) built-in function
> that discriminates between arrays and scalars.
>
> HTH.
>
> El 17/07/2017 a las 13:37, Peter Backes escribi?:
> > Hello,
> >
> > This was originally reported at
> > https://bugzilla.redhat.com/show_bug.cgi?id=1471421
> >
> > Description of problem:
> > when asking AWK for the type of an array variable, it incorrectly
> > claims that it is untyped.
> >
> > Version-Release number of selected component (if applicable):
> > gawk-4.1.3-8.fc25.i686
> >
> > How reproducible:
> > always
> >
> > Steps to Reproduce:
> > 1. gawk 'BEGIN { testx["bla"]="foo";testx["bla2"]="foo2";print
> > PROCINFO["identifiers"]["testx"]; split("cul-de-sac",a,"-",seps); print
> > PROCINFO["identifiers"]["a"],PROCINFO["identifiers"]["seps"];}'
> >
> > Actual results:
> > untyped
> > untyped untyped
> >
> > Expected results:
> > array
> > array array
> >
> > Additional info:
> > Same behavior actually for numbers and strings:
> >
> > % gawk 'BEGIN { x="test"; print PROCINFO["identifiers"]["x"];}'
> > untyped
> > % gawk 'BEGIN { x=5.5; print PROCINFO["identifiers"]["x"];}'
> > untyped
> >
> > Perhaps it is because "The values indicate what gawk knows about the
> > identifiers after it has finished parsing the program; they are not
> > updated while the program runs"
> > (https://www.gnu.org/software/gawk/manual/gawk.html)? Although I still
> > think it's a bug. In the examples given, the type IS statically known
> > after parsing. Because the respective identifiers are used in only one,
> > unique type of context. 'testx["bla"]="foo"' clearly says that testx is
> > an array, and if there is no conflicting assignment (such as testx =
> > "xyz") afterwards or before, the type must be array. What purpose would
> > PROCINFO["identifiers"] have anyway, if it wouldn't handle this basic
> > case well?
> >
> > PROCINFO["identifiers"]["PROCINFO"] correctly reports "array".
> >
> > Best wishes
> > Peter Backes
> >
>
> --
> Manuel Collado - http://lml.ls.fi.upm.es/~mcollado
>




reply via email to

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