bug-gawk
[Top][All Lists]
Advanced

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

Re: [PATCH] Feature: @local declares local variables.


From: arnold
Subject: Re: [PATCH] Feature: @local declares local variables.
Date: Sun, 10 Apr 2022 00:36:23 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Hi Kaz.

Thank you for submitting proposals for new features and for going
to the trouble of implementing them. That is unusual and requires
effort, which I appreciate.

Thanks to everyone else for their feedback.

In general, I wish to avoid adding any more features to the core
language.  I have found over the past several years that gawk suffers
from "C++ syndrome", whereby the interactions between features cause
unexpected confusion and bugs, leading to much debugging and extra
unanticpated effort on my part. (For example, indirect calls of builtin
functions passing too many or too few arguments. There are others.)

The local variable annotation feature promises to be one that will
only lead to confusion and abuse on the part of users, and I see
no reason to include it in gawk.

The "@local" statement would be nice to have, but I find it not
very compelling, given that awk already has a mechanism, if clumsy,
for declaring local variables, and I think that it would only serve
to unnecessarily futher gawk from standard awk, which I am loath
to do.

All that said, gawk is Free Software, and you are welcome to fork
it and make (and support!) your own distribution.  Quite seriously,
you have my blessing if you wish to do this, and I'll be glad to
answer questions you may have about the internals (although you seem
to have a good handle on them already).

I would ask that if you go down that path, that you modify the output
of --version to indicate that it's gawk + your mods, with a different
bug reporting address.

Thanks again,

Arnold


Kaz Kylheku <kaz@kylheku.com> wrote:

> Hi All,
>
> Taking into account mailing list feedback (Manuel, Neil, Ed)
> and my own ideas, I have produced a new patch that introduces
> both a @local statement, and a @local: variable annotation.
>
> The patch switches the fparms array of a function from
> being a dynamically allocated array of NODE objects to
> being a dynamically allocated array of NODE * pointers.
> This allows us to reallocate it to a larger size without
> changing the addresses of NODE objects, which are
> already entered into the symbol table and into the
> byte-code objects.
>
> The patch is more extensive, touching the debugger,
> profiler and pretty printing.
>
> I have added documentation, but test cases are still missing.
>
> This is still discussion level, proof-of-concept stage.



reply via email to

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