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: Wed, 13 Apr 2022 02:06:27 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Hi Kaz,

Looks nice. Best of luck with this. Thank you for the changes for
--help.

If you like I can add a pointer to this project in the gawk manual.
Let me know.

Arnold

Kaz Kylheku <kaz@kylheku.com> wrote:

> On 2022-04-09 23:36, arnold@skeeve.com wrote:
> > 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 for evaluating the patch. I agree with the remarks about
> @local, including the annotation. I have jettisoned @local
> entirely, and gone ahead with a more sophisticated feature: a single
> @let statement that provides true block-scoped lexical variables.
>
> Syntactically, it meets my use case as well as the annotation,
> and has better semantics. Function-wide local variables are
> a dodgy concept that is absent in our best programming languages.
> Moreover, @let works outside of functions too, whereas the original
> @local construct turned into a no-op.
>
> So for instance, we can do this
>
>    # one module's BEGIN block, out of many
>    BEGIN {
>      @let (x = 42)  # x is private, not visible anywhere else
>        foo = x + 3  # foo is global
>    }
>
> This work is hosted at https://www.kylheku.com/cgit/egawk/about
>
>
> > All that said, gawk is Free Software, and you are welcome to fork
> > it and make (and support!) your own distribution.
>
> By the way, I am a fan of your and Chet's "Fork My Code, Please"
> manifesto; I have shared a link to that with people more than once.
>
> > 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 have decided to call this "egawk" ("Enhanced Gawk").
> The executable name is that, which allows it to be easily installed
> side by side, in the same PATH as "gawk".
>
> The gawk-bug utility will not installed by "make install", and
> the --help usage looks like this:
>
> $ egawk --help | egawk '/bugs/,/^$/'
> To report bugs in Enhanced Gawk, send e-mail to
> Kaz Kylheku <kaz at kylheku dot com>.
> PLEASE do NOT try to report bugs or seek support in the original
> bug-gawk mailing list, unless you can reproduce the issue with the
> unmodified gawk program. Also do not report bugs in the comp.lang.awk
> Usenet newsgroup, or in web forum such as Stack Overflow.



reply via email to

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