bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gawk version 3.1.0 will not print a ";"


From: Paul Eggert
Subject: Re: gawk version 3.1.0 will not print a ";"
Date: Wed, 23 Jan 2002 11:18:28 -0800 (PST)

> From: Aharon Robbins <address@hidden>
> Date: Wed, 23 Jan 2002 14:55:33 +0200
> 
> The following patch makes things work better, although I'm not 100%
> convinced it's The Right Thing.

Nor am I.  Surely the fundamental problem here is the syntax that Gawk
uses for translatable strings.  Gawk borrowed from the common practice
in C-language GNU applications, which use _("xxx") to translate the
string "xxx".  But this common practice is one of C applications, not
of C implementations: it was constrained by the need to avoid any
change to the C language, and so it's not necessarily an appropriate
choice for Gawk, where the constraint is instead the need to avoid
gratuituous changes in behavior.

Gawk can avoid the problem by using an unambiguous syntax instead, one
that is a pure extension to the Awk language.  Bash uses the syntax
$"xxx", for example; this is an unambiguous extension to the shell
language, but it won't work for Awk since $"3" already has a meaning
in Awk.

Perhaps Awk could use the syntax `"xxx" instead of _"xxx"; that would
be unambiguous.  If you don't like ` then there are several other
possibilities, including /, %, *, &, |, ^, \, and @.


> From: Aharon Robbins <address@hidden>
> Date: Wed, 23 Jan 2002 14:07:44 +0200

> If you use `gawk --posix' on the original program, it will also be
> parsed "correctly."

This also suggests that the _"xxx" syntax can be improved upon.
All other things being equal, a syntax that is upward compatible with
POSIX is better than an incompatible extension.

This reminds me -- have you thought about the suggestions I made last
March to change Gawk so that it is POSIX-compatible by default?  I
volunteered to code up some patches to that effect, but don't recall
getting a response; perhaps I missed it.

Here is what I proposed, to refresh your memory:

 1. Change gawk to follow egrep's lead in supporting interval
    expressions only when POSIX requires it.  This will remove gawk's
    only incompatibility with POSIX.

 2. Change gawk so that POSIXLY_CORRECT has no effect.  Combined with (1),
    this will make gawk conform to the GNU coding standards.

 3. Change --posix so that it disables all extensions to POSIX regular
    expressions, not just some of them.

 4. Remove the --re-interval option; it's no longer needed because of (1).

(Hmm, when I wrote (1) last March, I wasn't aware of the new _"xxxx"
incompatibility.  Are there others that I don't know about?)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]