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

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

Re: [gettext] changequote considered harmful


From: Stepan Kasal
Subject: Re: [gettext] changequote considered harmful
Date: Thu, 28 Jul 2005 14:33:53 +0200
User-agent: Mutt/1.4.1i

Hello,

On Wed, Jul 27, 2005 at 04:55:58PM +0200, Bruno Haible wrote:
> > +typedef int array [[2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]];

OK, I think I see why you don't like this.  (Paul Eggert prefers it, so I
tried it... ;-).

Actually, my preference is to quote the whole blocks of text which
I don't want to get screwed by the macro code.

IOW, I replace the pair
        changequote(,)   changequote([,])
with
        [                ]

My previous patch was a mix of these two methods.  I updated it to use
this one consistently; the new patch is attached to this mail.

Let me explain:

You spoke about mixing different syntaxes.  Well that's an important feature
of macro languages:  literal text is intermixed with macro calls.

On one side, this simplicity is one of the most appealing properties of
macro languages.

OTOH, this means you inevitably get into situation where some text/code is
screwed ^H^H^H^H^H^H^H^Hexpanded even though it was meant as literal text/code.

To fix this problem, you have to mark the literal text with \begin{verbatim}
\end{verbatim} or some such.
The changequote() call is of the same type as TeX's verbatim environment:
it changes the lexical analyzer temporarily.  I think this is the more
obscure solution.  As I said, it is more risky, and I mentioned some examples
in my previous mail.

I think it's cleaner to use a pair of quotes instead.  This cleanly and exactly
expresses the intention: "this is shell (or C) code; do not touch!"

Have I convinced you?

Have a nice day,
        Stepan


PS:
Actually, all literal code should be quoted, something like

AC_CHECK_FUNC([sinh], [[sinh_found=yes]], [[sinh_found=no]])
[if test $sinh_found = no; then]
  AC_MSG_WARNING([[sinh not found]])
[fi]

But hey, that's not possible in real life.

Attachment: gettext-20050728-changequote.patch
Description: Text document


reply via email to

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