Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

I THINK MAN INVENTED THE CAR by instinct. -- Jack Handey, The New Mexican, 1988.


devel / comp.lang.awk / Re: egawk: Enhanced GNU Awk

SubjectAuthor
* egawk: Enhanced GNU AwkKaz Kylheku
+* Re: egawk: Enhanced GNU AwkJanis Papanagnou
|`- Re: egawk: Enhanced GNU AwkKaz Kylheku
`* Re: egawk: Enhanced GNU AwkEd Morton
 `* Re: egawk: Enhanced GNU AwkKaz Kylheku
  `- Re: egawk: Enhanced GNU AwkEd Morton

1
egawk: Enhanced GNU Awk

<20220412184113.876@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1210&group=comp.lang.awk#1210

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-1380@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.awk
Subject: egawk: Enhanced GNU Awk
Date: Wed, 13 Apr 2022 01:50:56 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <20220412184113.876@kylheku.com>
Injection-Date: Wed, 13 Apr 2022 01:50:56 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a83b8375c1086bb86b4743af5b28ca33";
logging-data="14846"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/tlS4LGfwx+tYiu7fYVvzCWa8+0Odt/HY="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:SrLMOwW2lZggW8kbGRn+yL87Tio=
 by: Kaz Kylheku - Wed, 13 Apr 2022 01:50 UTC

I have started a repository called Enhanced GNU Awk.

https://www.kylheku.com/cgit/egawk/about/

This adds true local variables to Gawk, in the form of a @let
construct. @let is block scoped, not function scoped, and
may be used outside of functions, e.g.

BEGIN {
@let (here_only = 42) {
print here_only
}
}

I need this for the cppawk project, which has macros. macros sometimes
need hidden temporary variables. It's very bad if these are global.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: egawk: Enhanced GNU Awk

<t360ei$n6n$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1211&group=comp.lang.awk#1211

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: egawk: Enhanced GNU Awk
Date: Wed, 13 Apr 2022 10:08:50 +0200
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <t360ei$n6n$1@dont-email.me>
References: <20220412184113.876@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 13 Apr 2022 08:08:50 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4e11459429573e2d0bc642d170eaaabe";
logging-data="23767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UY+FwZ4us9IHGqH5Nkipx"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:oBMEUji7TLlseLNjkPyY9zvb1kY=
In-Reply-To: <20220412184113.876@kylheku.com>
 by: Janis Papanagnou - Wed, 13 Apr 2022 08:08 UTC

On 13.04.2022 03:50, Kaz Kylheku wrote:
> I have started a repository called Enhanced GNU Awk.
>
> https://www.kylheku.com/cgit/egawk/about/
>
> This adds true local variables to Gawk, in the form of a @let
> construct. @let is block scoped, not function scoped, and
> may be used outside of functions, e.g.
>
> BEGIN {
> @let (here_only = 42) {
> print here_only
> }
> }
>
> I need this for the cppawk project, which has macros. macros sometimes
> need hidden temporary variables. It's very bad if these are global.

Understood.

Are GNU Awk Namespaces[*] not sufficient to address the problem?

Janis

[*] https://www.gnu.org/software/gawk/manual/gawk.html#Namespaces

Re: egawk: Enhanced GNU Awk

<t36fms$9rl$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1213&group=comp.lang.awk#1213

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.lang.awk
Subject: Re: egawk: Enhanced GNU Awk
Date: Wed, 13 Apr 2022 07:29:16 -0500
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <t36fms$9rl$1@dont-email.me>
References: <20220412184113.876@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 13 Apr 2022 12:29:16 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="7ac59a1f0884873492f2f57716e24299";
logging-data="10101"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lAulfL9zP2/vqe3PejlFI"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:dBQ2CbLjlXgqspIMDM33Ocl9pqc=
In-Reply-To: <20220412184113.876@kylheku.com>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 220413-0, 4/13/2022), Outbound message
 by: Ed Morton - Wed, 13 Apr 2022 12:29 UTC

On 4/12/2022 8:50 PM, Kaz Kylheku wrote:
> I have started a repository called Enhanced GNU Awk.
>
> https://www.kylheku.com/cgit/egawk/about/
>
> This adds true local variables to Gawk, in the form of a @let
> construct. @let is block scoped, not function scoped, and
> may be used outside of functions, e.g.
>
> BEGIN {
> @let (here_only = 42) {
> print here_only
> }
> }
>
> I need this for the cppawk project, which has macros. macros sometimes
> need hidden temporary variables. It's very bad if these are global.
>

Much like the now ancient "New awk", nawk, "Enhanced awk" isn't a great
name as it could be used for any project that adds functionality and
doesn't tell you anything about the tool. I have my own Extended Print
awk (epawk) tool that allows "here" documents in an awk script (see
https://stackoverflow.com/a/24597515/1745001) that I could have named
"Enhanced awk" instead of "Extended print awk" but that's not
descriptive of the functionality it provides.

Maybe you could follow in the footsteps of Mike's Awk, mawk, and
Thompson's awk, tawk, and name this Kaz/Kyheku's awk, kawk? Or maybe
"Let awk", lawk, or "Local Variables awk", lvawk, to really capture what
this awk is for unless you plan to add more functionality later?

Ed.

Re: egawk: Enhanced GNU Awk

<20220413102943.810@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1214&group=comp.lang.awk#1214

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-1380@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.awk
Subject: Re: egawk: Enhanced GNU Awk
Date: Wed, 13 Apr 2022 21:21:26 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <20220413102943.810@kylheku.com>
References: <20220412184113.876@kylheku.com> <t360ei$n6n$1@dont-email.me>
Injection-Date: Wed, 13 Apr 2022 21:21:26 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a83b8375c1086bb86b4743af5b28ca33";
logging-data="9057"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TiONebH/13roCmb+KiX6FZ+8t1wSdX40="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:fJ4c6j1mbn80Ja0ZysPJwV4+Ks0=
 by: Kaz Kylheku - Wed, 13 Apr 2022 21:21 UTC

On 2022-04-13, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
> On 13.04.2022 03:50, Kaz Kylheku wrote:
>> I have started a repository called Enhanced GNU Awk.
>>
>> https://www.kylheku.com/cgit/egawk/about/
>>
>> This adds true local variables to Gawk, in the form of a @let
>> construct. @let is block scoped, not function scoped, and
>> may be used outside of functions, e.g.
>>
>> BEGIN {
>> @let (here_only = 42) {
>> print here_only
>> }
>> }
>>
>> I need this for the cppawk project, which has macros. macros sometimes
>> need hidden temporary variables. It's very bad if these are global.
>
> Understood.
>
> Are GNU Awk Namespaces[*] not sufficient to address the problem?

For the above specific example situation (module variables), yes.
For macros, no.

I'm already using a portable namespacing mechanism which is to prepend two
underscores on all private symbols, including macro-generated temporaries.

GNU Awk prohibits namespaced identifiers from being used as function
parameters, so all namespaced variables are necessarily global.
(I preserved this restriction in @let: it won't allow names like
foo::bar).

At first I implemented a @local mechanism which had function-wide scope
for variables. That was less work, but it doesn't solve the problem in
situations when constructs nest and happen to choose the same variable.

In the C preprocessor, the options are very limited for generating
temporary names. You're looking at something like

#define __temp(pfx) __ ## pfx ## __LINE__

The __LINE__ is derived from the top-level macro invocation. So
if you have a bunch of nested syntax in that macro call which contains
__temp(x), all the __temp(x) will generate to the same thing: __x42 if the
macro is called on line 42.

With true lexical scope, this becomes a non-issue. E.g.
if we generate, say, some nested loops like this, we have a problem:

for (__x42 = 0; __x42 < ...;__x42++)
for (__x42 = 0; __x42 < ...; __x42++)

but it goes away if we add @let:

@let (__x42) for (__x42 = 0; __x42 < ...; __x42++)
@let (__x42) for (__x42 = 0; __x42 < ...; __x42++)

The reuse of __x42 and _n42 isn't a problem now (with certain
additional care).

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: egawk: Enhanced GNU Awk

<20220413110237.469@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1215&group=comp.lang.awk#1215

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-1380@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.awk
Subject: Re: egawk: Enhanced GNU Awk
Date: Wed, 13 Apr 2022 21:33:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <20220413110237.469@kylheku.com>
References: <20220412184113.876@kylheku.com> <t36fms$9rl$1@dont-email.me>
Injection-Date: Wed, 13 Apr 2022 21:33:19 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a83b8375c1086bb86b4743af5b28ca33";
logging-data="17255"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18laocQkhJwjZ8CTh5GeC9au8gG+ApvIq8="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:WGjxQa8IG/2g5sniU5M5DRxYhjY=
 by: Kaz Kylheku - Wed, 13 Apr 2022 21:33 UTC

On 2022-04-13, Ed Morton <mortonspam@gmail.com> wrote:
> On 4/12/2022 8:50 PM, Kaz Kylheku wrote:
>> I have started a repository called Enhanced GNU Awk.
>>
>> https://www.kylheku.com/cgit/egawk/about/
>>
>> This adds true local variables to Gawk, in the form of a @let
>> construct. @let is block scoped, not function scoped, and
>> may be used outside of functions, e.g.
>>
>> BEGIN {
>> @let (here_only = 42) {
>> print here_only
>> }
>> }
>>
>> I need this for the cppawk project, which has macros. macros sometimes
>> need hidden temporary variables. It's very bad if these are global.
>>
>
> Much like the now ancient "New awk", nawk, "Enhanced awk" isn't a great
> name as it could be used for any project that adds functionality and

Right, which is why the name is "Enhanced GNU Awk" (egawk), not
"Enhanced Awk", which would be a terrible name.

I believe that the space of things that are "fork of GNU Awk"
is tiny; this might be the only one.

If someone else makes a fork of GNU Awk and also wants to call it
egawk, we can work it out. Possibly by merging projects into one.

(Forks are not so good, by the way; I'd *much* rather have this upstreamed,
but the project isn't interested.)

> Maybe you could follow in the footsteps of Mike's Awk, mawk, and
> Thompson's awk, tawk, and name this Kaz/Kyheku's awk, kawk? Or maybe

In today's prudish social justice environment teeming with snowflakes
who are perpetually on the verge of tears, "kawk" would likely
be regarded in many projects as a "CoC" violation.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: egawk: Enhanced GNU Awk

<29a016cc-64a3-4f4d-bfb4-4a25679d289an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1216&group=comp.lang.awk#1216

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:6214:d42:b0:441:831b:fa1b with SMTP id 2-20020a0562140d4200b00441831bfa1bmr10818149qvr.130.1649903884334;
Wed, 13 Apr 2022 19:38:04 -0700 (PDT)
X-Received: by 2002:a81:9e46:0:b0:2eb:f83b:2181 with SMTP id
n6-20020a819e46000000b002ebf83b2181mr415075ywj.87.1649903884091; Wed, 13 Apr
2022 19:38:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Wed, 13 Apr 2022 19:38:03 -0700 (PDT)
In-Reply-To: <20220413110237.469@kylheku.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.46.252.196; posting-account=rv7-7goAAAAyBCsUgaHaGs9haWRFGhT0
NNTP-Posting-Host: 98.46.252.196
References: <20220412184113.876@kylheku.com> <t36fms$9rl$1@dont-email.me> <20220413110237.469@kylheku.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <29a016cc-64a3-4f4d-bfb4-4a25679d289an@googlegroups.com>
Subject: Re: egawk: Enhanced GNU Awk
From: mortonspam@gmail.com (Ed Morton)
Injection-Date: Thu, 14 Apr 2022 02:38:04 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 11
 by: Ed Morton - Thu, 14 Apr 2022 02:38 UTC

On Wednesday, April 13, 2022 at 4:33:21 PM UTC-5, Kaz Kylheku wrote:
> On 2022-04-13, Ed Morton <morto...@gmail.com> wrote:
<snip>
> > Maybe you could follow in the footsteps of Mike's Awk, mawk, and
> > Thompson's awk, tawk, and name this Kaz/Kyheku's awk, kawk? Or maybe
> In today's prudish social justice environment teeming with snowflakes
> who are perpetually on the verge of tears, "kawk" would likely
> be regarded in many projects as a "CoC" violation.

Ah, good point, then you should name it Forked Awk - fawk :-).

Ed.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor