bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] gawk: questions:


From: Denis Shirokov
Subject: [bug-gawk] gawk: questions:
Date: Sat, 12 Jan 2013 19:07:28 +0200

Hi GAWK,

I have some questions

1)Why:
isarray(A[1]) - creates string element at A[1] if A was never defined
as array nor string?
BEGIN{
        if ( 1 in A )                   print "A: is EXIST"
        if ( isarray(A[1]) )            print "B: is Array"
        if ( 1 in A )                   print "C: is EXIST" }
prints:
C is EXIST

This is not right. I just answer `A[1] is actually array?' - this
question exactly means that element can be string or array or
undefined - and if it's undefined - then it should be stay undefined.
This linked with the (in my opinion) most serious gawk problem: it's
actually do not provide script to know whether function parameter
presented as array, as string, or it's undefined. Of course i can: if
( p==0 && p=="" ) - but it will fail execution if parameter is defined
array. I can previously answer is p is defined array ? But if it not -
then it will now be a string. Is this situation solid?
isarray should change nothing.

2) Linked with the 1.
The same story we see when we have undefined array A, and call
function with the A[1] as the one of the input parameters that is
meaning: array A, subarray 1(both for this moment still not defined);
and in function body we see that A[1] already defined as the string.
We can provide some primary parser extension for source script : if
character "\" preceeding Name - then it's forced interpreting as
without any type definition.

BEGIN{ abc(\A[1],2) }
func abc(p,n) { if (n in p)...

 -this should have the false result instead the gawk fatal error
"trying to use scalar as an array"

3) By preceding any read operations with arrays by character "\" we
actually means SAFEREADOPERATION - with the same results but without
autodefinition element(as the string). This can reduce code and makes
performance growing up. Also it will open some GAWK feature areas that
is currently unavailable but possible.

4) Is there planing releases of GAWK after 4.0.1? Are you have some
feature request services? What will be include in the next releases?
is there a way to affect on GAWK features in the next release?

Respect
Digi








Today i'm working with the large data in GAWK.



reply via email to

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