ap

Tom Christiansen tchrist at convex.COM
Wed Jun 5 04:29:21 AEST 1991


>From the keyboard of byron at archone.tamu.edu (Byron Rakitzis):
:After compiling perl on my system and being nauseated by the syntax of
:the language, I've decided to try to come up with my own alternative.
:I'm going to call it ap, or anti-perl.

nauseated?  you must have a weak stomach.


:Right now I'm thinking that ap will be a super-awk that is less
:confusing for a C programmer to learn. 

I've never met a *good* C programmer who's had any real problems with it.
There may be a momentary bit of discomfort at seeing dollar signs and
thinking of BASIC, but this quickly passes.  Certainly no *good* programmer
finds it hard.

: Functions would be a nice thing to have, but it must
:always be easy to toss off a quick one-line ap script, i.e., in the
:most trivial case I would like something like
:
:	ypcat hosts | ap 'print $1'
:
:or something similar to work just right. I hate having to place braces
:around that simple statement as one has to do in awk.

You mean like these:

    ypcat hosts | perl -ane "print $F[0]\n"
    ypcat hosts | perl -pe "s/\s.*//'

or skipping ypcat:

    perl -e 'while (@F=gethostent) { print "$F[0]\n"; }'
    perl -e '$\ = "\n"; while (($_)=gethostent) { print; }'


:Most importantly, ap will be driven by an easy-to-understand grammar
:with C-like syntax. There may be 2 or 3 ways to perform a particular
:task, but there will not be 10,000 as there are in perl.

Perl does have a C like syntax at its base.  Certainly it's not much more
than 2x as complex, if that.   Without C, there'd never have been a perl.

But certainly you have a point -- down with expressiveness!  Let's also
redesign English so there are no synonyms, either lexical or phonetic.
Who cares whether connotations, expressiveness, or etymologies get lost in
the shuffle?   They just clutter up the the language and make it gross.  

And let's please fix C while we're at it.  The way you declare arrays of
pointers to functions returning pointers to functions returning pointers
to stat structs really nauseates me.  Plus did you know that C has several
ways of expressing the same thing?  It's really disgusting.  Check out the
flow control: all you need is a for loop; we should abolish the while and
the do loops.  Or how about saying char *foo versus char foo[] in formal
parameters? What stupid redundancy!  Let's all flame Dennis Ritchie.

As you see, this would be a silly thing.  Nothing's perfect in this
world.  Both Dennis and Larry (and the awk people, too) tried to come up
with something to solve a certain set of needs they had at the time.
These weren't the same sets of design criteria, of course.  The fact that
despite their flaws, both C and perl are used proves their utility.

:Ideas are welcome. I really want to write this thing; perl is a
:disgrace to the Unix community.

No -- your statement is.  Fortunately, considering how much perl
has caught on, you're clearly not speaking for the UNIX community.
As for beauty, re-read the third sentence from the perl man page:

     The language is intended to be practical (easy to use, efficient,
     complete) rather than beautiful (tiny, elegant, minimal).

I truly suggest that you relax and see whether your initial shock goes
away.  If you find perl helps you get your job done more easily, then use
it.  If not, then don't!  No one's forcing you.

If your sensibilities are so very offended by its lack of apparent beauty,
then fine, go off and write your own language.  But don't go asking the
net to tell you how to do it.  Great things come from single visions, not
from designs by committee.  If whatever you come up with is really so
wonderful, then it will become popular; if not, it won't.  Let empirical
evidence decide: good software drives out bad.

--tom
--
Tom Christiansen		tchrist at convex.com	convex!tchrist
	    "Perl is to sed as C is to assembly language."  -me



More information about the Comp.unix.shell mailing list