Article View: comp.unix.shell
Article #4614Gawk v24.7: Why Bother???
From: Tom Christiansen
Date: Sat, 15 Apr 1995 00:00
Date: Sat, 15 Apr 1995 00:00
170 lines
5970 bytes
5970 bytes
Someone sent me a gawk script. They were very, very proud of its "new"
ability to say "next file". Of course, it didn't run for me, so I had to
fetch a current copy of gawk. I a couple revisions out of date. Fine.
Let me preface this with stating that I entirely agree that the world
needed a freely redistributable version of awk that was a proper superset
of everything in the nawk book. But beyond that, this is all just feeping
creaturism with a mind of its own. Why did you have to keep adding more
bells and whistles? Now people are writing programs in the "gawk"
language. We didn't need a different dialect. There should have been one
awk: in these days, I guess that would be the POSIX awk.
Then when I got to looking around, I was deeply aghast to read what was in
the current FUTURES file, I simply couldn't believe it. It read just like
a treatise on how to recreate Perl! Doesn't anyone out there realize that
we've already done all this stuff -- most of it many years ago??? Now,
the couple things in the gawk wish-list that Perl doesn't do yet (like
compile into C) have always been on its "WISHES" list as well.
Beyond that, I checked out the docs for gawk, and diffed them in my mind
with awk, and there didn't seem to be anything innovative there at all.
Everything that's been added was already in Perl, one way or the other.
(For example, it's not print "blah" > "/dev/stderr", but rather just
print STDERR "blah".)
I enclose that FUTURES file as an attachment, with commentary. I just
don't understand: Why would anyone want to spend so much of their life
(incompatibly) re-inventing the wheel (not to mention when their final
creation will still be mere training wheels)?
For 2.16
========
x Move to autoconf-based configure system.
Perl does this (although it uses its metaconfig's Configure)
x Research awk `fflush' function.
Perl can already flush its handles. In fact, it's always been
able to.
x Generalize IGNORECASE
any value makes it work, not just numeric non-zero
make it apply to *all* string comparisons
Perl's matches already do this, and far better. you can
on a per-match basis set the flag. you can even embed it
in a variable that you then match on.
In 2.17
=======
x Allow RS to be a regexp.
Easy to emulate in Perl.
RT variable to hold text of record terminator
Perl's readline function already retains this.
RECLEN variable for fixed length records
Perl already does this using a C-style read() function.
Feedback alloca.s changes to FSF
x Split() with null string as third arg to split up strings
Perl already does this.
x Analogously, setting FS="" would split the input record into
individual characters.
Um, hey gusy, don't you thing getc() would be better? Yes, Perl has this.
x Extensive manual cleanup:
Use of texinfo 2.0 features
Lots more examples
Document all of the above.
It would be nice if all GNU docs were in a form that allowed one to
generate more than mere texinfo format. Perl's doc set can generate
HTML, troff, or latex output.
For 2.18
========
DBM storage of awk arrays. Try to allow multiple dbm packages
Perl already does this, and much more along these lines.
General sub functions:
edit(line, pat, sub) and gedit(line, pat, sub)
that return the substituted strings and allow \1 etc. in the sub
string.
Perl already does this -- and always has, plus much more along these lines.
? Have strftime() pay attention to the value of ENVIRON["TZ"]
If your POSIX C library does this, then so does Perl. In fact, Perl
supports all of the 1003.1 spec.
For 2.19
========
Add chdir and stat built-in functions.
Perl already does this -- and always has, and much more along these lines.
Add function pointers as valid variable types.
Perl already does this, and much more along these lines.
Add an `ftw' built-in function that takes a function pointer.
Perl already does this.
Do an optimization pass over parse tree?
Perl already does this.
For 2.20 or later:
==================
Add variables similar to C's __FILE__ and __LINE__ for better diagnostics
from within awk programs.
Perl already does this, and much more along these lines.
Add an explicit concatenation operator and assignment version.
Perl already has this, and always has.
Add the ability to seek on an open file and retrieve the current
file position.
Perl already does this, and always has.
Add lint checking everywhere, including check for use of builtin vars.
only in new awk.
Perl already does this, if I understand what you mean.
"restart" keyword
What's that do?
Add |&
Oh, yes, let's perpetuate Cshisms. Good move.
Do a reference card
Perl already has this.
Allow redefining of builtin functions?
Perl already has this.
For 3.x:
========
Provide awk profiling and debugging.
Perl already has this.
There -- see what I mean?
--tom
--
Tom Christiansen Perl Consultant, Gamer, Hiker tchrist@mox.perl.com
What sane person could live in this world and not be crazy?
-- Ursula K. LeGuin
Technical Details
Message-ID:
<3mpj9f$d1h@csnews.cs.colorado.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1025b4,4df32fd703a6b724,start X-Google-Attributes: gid1025b4,public X-Google-Thread: 1012a6,4df32fd703a6b724,start X-Google-Attributes: gid1012a6,public From: Tom Christiansen <tchrist@mox.Perl.com> Subject: Gawk v24.7: Why Bother??? Date: 1995/04/15 Message-ID: <3mpj9f$d1h@csnews.cs.colorado.edu> X-Deja-AN: 100431198 organization: Perl Consulting and Training reply-to: tchrist@mox.Perl.com (Tom Christiansen) newsgroups: comp.unix.shell,gnu.misc.discuss originator: tchrist@mox