On Sun, Jul 17, 2016 at 3:08 PM, Andy Chu <andyc...@gmail.com> wrote:
> However, I did a bunch of research and hacking on Kernighan's Awk.  I
> was trying to morph it into a "proper" modern language.  For example,
> you could imagine writing "ls" or "xargs" or even a shell in Awk, sort
> of like the idea to write tools in Lua.

Er, why?

I attended a talk decades ago by Tom Weinberger, the W in awk.  He
stated that awk was originally designed for writing "one liners" to be
run from the command line in a terminal, and described his shock the
first time he saw a multi-page awk script.

There are lots of domain specific little languages, intended to
address particular problems, and attempts to expand them rapidly grow
out of scope.  You reach a point where what you are trying to do is
something else's job, and you should simply use the something else.

That's the case with awk.  It should not  *be* a general purpose
scripting language in which you might implement a shell.  It's
intended to query and modify the contents of arbitrary text files,
based on supplied parameters and conditionals in the awk script.  If
you need to do more than that, awk isn't what you use.

The original design of Unix was one tool for one job, with shell
scripts the glue to tie together disparate tools to perform complex
operations, and text files as the common medium to pass things between
them.  That ideal has been increasingly lost, and perl might be
considered an example.  Its "there's more than one way to do it"
paradigm is likely a greater weakness than a strength.  There is more
than one way, but which is best?  How do you know?"  And the nature of
the perl language leads to the old joke in classifying languages by
how you shoot yourself in the foot:

Perl: You shoot yourself in the foot, but no one else can understand
how you did it.  Six weeks later, neither can you.

Awk was created to perform a particular job and fill a particular
niche.  Attempting to expand it beyond that is likely an error.
______
Dennis
https://plus.google.com/u/0/105128793974319004519
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to