bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gawk: questions:


From: Aharon Robbins
Subject: Re: [bug-gawk] gawk: questions:
Date: Sun, 13 Jan 2013 21:12:37 +0200
User-agent: Heirloom mailx 12.5 6/20/10

Greetings. Re this:

> Hi GAWK [Developers],
>
> I have some questions
>
> 1)Why:
> isarray(A[1]) - creates string element at A[1] if A was never defined
> as array nor string?

When you reference an array element that doesn't exist, awk automatically
creates it with an empty value.  Awk has always worked that way and this
is well documented.

I believe you are confused because you are somehow expecting new elements
to be subarrays instead of scalars. If you want an element of an array
to be a subarray, you must use it as an array the first time it is
referenced:

        array[1]["junk"] = 5    # force array[1] to be subdirectory
        delete array[1]["junk"] # remove dummy element
        isarray(array[1])       # will now be true

If you don't do something like this, gawk has no way to know that you
expect plain `array[1]' to be a subarray and not a scalar.

> 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.

Since you write the function, and the code calling it, you should know
what is being passed.  Awk is not a strongly typed language, and it
doesn't protect you from everything.  That is simply the way it is,
even if it might have been done better if things were designed over again.

> 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.

I am afraid I don't understand what you mean here. In any case, I think
this suggestion comes from a misunderstanding as to how gawk handles
subarrays.

> 4) Is there planing releases of GAWK after 4.0.1?

4.0.2 was released a few weeks ago. It was announced on the info-gnu
mailing list and in comp.lang.awk.

> What will be include in the next releases?

You can check out the current development version by looking in the master
branch of the git repository.  The main new changes are support for
arbitrary floating point arithmetic with MPFR and GMP, and a new API
for adding extensions in C.

> Are you have some feature request services?

You can request features by writing to the bug address. However, the
trend I would expect to see is that most new features are done via
extensions contributed by users via the new API, as opposed to those
that add to the core code base.

In general, I do not wish to add lots of new language features, I think
gawk already has too many.

> is there a way to affect on GAWK features in the next release?

The best way is to

        (a) make a convincing case that the feature is generally useful,
        (b) and not doable using existing features of either awk or
            the extension API
        (c) contribute the code and documentation for the feature and
            be willing to sign the paperwork needed by the FSF

Of course, I am always willing to discuss my consulting rates, as well.

Thanks,

Arnold



reply via email to

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