home *** CD-ROM | disk | FTP | other *** search
- Submitted-by: arnold%audiofax.com@mathcs.emory.edu (Arnold Robbins)
-
- >In article <1991May14.185737.15746@uunet.uu.net> arnold@audiofax.com writes:
- >> One of the things that happened when new awk was first realeased was a lot
- >> of cleaning up and consistencizing (if I may coin a term) of the awk
- >> language.
-
- In article <1991May15.165824.6896@uunet.uu.net> peter@ficc.ferranti.com (Peter da Silva) writes:
- >I don't see how that makes things any more consistent. If you look at the
- >grammer there's no ambiguity that needs to be resolved by adding that
- >semicolon. Does anyone have an idea what the reasoning behind this was?
- >To me, it adds confusion by treating a block as a statement.
-
- This is getting off the topic of standards, but what the heck. You
- ommitted my rationalization of the consistency. To rephrase: statements
- at the rule level should be consistent with statements inside an action.
- Statements in a action are separated by newline or semi-colon, therefore
- rules (patterns plus actions) should also be separated by newlines or
- semi-colons. It is illegal to type
-
- { i = 1 j = 2 }
-
- in an action without the semicolon or newline between the assignments.
- Therefore it "should" be illegal to type rules without the separator.
- (So yes, block are statements. This makes sense, since they're executed
- in the order they occur in the program.)
-
- As I also mentioned, modern implemenations of 'nawk' (V.4 nawk, gawk)
- accept rules with or without the semicolon, so it doesn't really matter.
- (Many C compilers continue to accept `i =+ 1' but that doesn't make it
- good programming practice...)
-
- >Oh, and my V.3.2 system has no problem with that:
- >
- >% ls -l | awk 'NF==9 { h[$3] += $5 } END {for(i in h) print i,h[i]}'
- >root 7985
- >peter 731662
-
- You typed "awk", no 'n'. My example used "nawk", with an 'n'. Try
-
- awk 'BEGIN { foo() }
- function foo () { print "hi" }'
-
- on your V.3.2 system and watch "awk" (no 'n') barf all over your screen.
- We're talking two very different animals here.
-
- For whatever it's worth, the V.3.2 nawk man page said that in the "next
- major release" nawk would become 'awk' and old awk would become 'oawk'.
- This doesn't seem to have happened in V.4. It probably never will in
- System V. 4.4BSD will most likely ship gawk for it's version of awk.
-
- Next topic, please?
- --
- Arnold Robbins AudioFAX, Inc. | Threads are the
- 2000 Powers Ferry Road, Suite 200 / Marietta, GA. 30067 | lack of an idea.
- INTERNET: arnold@audiofax.com Phone: +1 404 618 4281 | -- Rob Pike
- UUCP: emory!audfax!arnold Fax-box: +1 404 618 4581 |
-
- [ He's right. I've cross-posted this to comp.unix.questions, with
- followup's directed there. -- mod ]
-
- Volume-Number: Volume 23, Number 72
-
-