[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettext feature request
From: |
Chet Ramey |
Subject: |
Re: gettext feature request |
Date: |
Fri, 13 Aug 2021 16:13:29 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 |
On 8/13/21 12:14 PM, Jean-Jacques Brucker wrote:
I'm probably less familiar with the history of shells and bash than you (and
others on this mailing list), but it seems to me that:
First were the chains:
* '...' who did not expand anything
* "..." which expanded the syntaxes $VAR and the unfortunate `...` [1]
Then the syntax $"..." was introduced, then the syntax $'...' (bash 2.X).
That's when bash introduced it. I picked it up from ksh93 with an existing
meaning and semantics, and there was no reason to be incompatible. The
$'...' syntax kind of came in the same way, but there was some discussion
among shell maintainers at the time (early 2000s) about how to do it.
I don't know how many other shells besides bash and ksh93 implement $"...".
There are several that implement $'...' (mksh, zsh, NetBSD sh, FreeBSD sh)
and several that don't (dash, yash).
There is an existing proposal -- dating from 2010 -- to add $'...', based
originally on the bash implementation, to the next version of POSIX. There
have been various hangups, to say the least. The current issue is how to
specify the \U and \u escape sequences. (Bash converts the hex digits to a
32-bit quantity and uses iconv to convert it to a character in the current
locale, falling back to UTF-8 and, in a pinch, C escape sequences.)
As the character '$' means "interprets (synonym: translates) what follows", it
seems to me quite consistent that $"..." means "translates the entire
following
string"
Conversely, the syntax $'...' seems to me much less consistent. (Reminder:
C is
prior to shells, and bash is itself written in C).
C isn't really "prior" to shells. There was a shell in the first edition,
and that predated C. But that's neither here nor there. We have what we
have.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/