Re: text in programming languages, Unicode in strings

Liste des GroupesRevenir à c arch 
Sujet : Re: text in programming languages, Unicode in strings
De : SFuld (at) *nospam* alumni.cmu.edu.invalid (Stephen Fuld)
Groupes : comp.arch
Date : 20. May 2024, 21:19:59
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v2g7ou$50do$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : XanaNews/1.21-f3fb89f (x86; Portable ISpell)
Anton Ertl wrote:

"Stephen Fuld" <SFuld@alumni.cmu.edu.invalid> writes:
Scott Lurndal wrote:
 
"Stephen Fuld" <SFuld@alumni.cmu.edu.invalid> writes:
MitchAlsup1 wrote:
 
And I miss some equivalent of picture clauses in C every time I
see, >> > including in this NG, a number consisting of a string of
say 8 or 9 >> > or more digits without the every three digit
separator character, >> > which sure makes reading such numbers
easier.  :-( >>
printf has supported that capability for decades.
 
$ LANG=en_US.utf8 printf "%'10.2f\n" $(( 1540.0 * 179.47 + (7928 +
401 - 535)  * 67.61 + 2295 * 173.35  + 3230 * 191.00 + 192 *
750.15 + >> 150 * 509.85 + 254 * 6> 2,505,496.61
 
If the mechanisms that you and Anton present were so easily
available, why do I see so many instances of "non separated"
outputs?
 
What locale are you using?

I happen to be in the US, however . . . 


When I mentioned "in this NG", I meant posts that present the outputs
of some similation program, reduced trace data, GREP output, etc.  I
certainly don't want to deprecate such posts, as clearly having actual
data is better than even informed guesses or opinions.  And,in regards
to locale, I can handle just fine, numbers presented with just about
any reasonable separator - I am not insisting on commas. But I suspect
that most readers in this news group would be happy with either commas
or periods, spaces, underscore, etc. The key is something versus
nothing.



 
Are they
too recent,
 
SUSv3 is from 2001.  But have Windows implementations of printf and
scanf implemented the "'" flag?  If so, when?
 
or are programmers too lazy, or do they believe that users
don't care (i.e. that I am in a minority)?
 
An alternative explanation is that programmers believe that users care
that the output of the program can be used as input to programs with a
minimum of fuss.


Good point. 



There are two difficulties here:
 
* There are likely programs that do not understand input with
  thousands separators.  This includes the printf program shown above
  at least as supplied with Debian 12.  So if a program outputs
  thousands separators, there may be difficulties in feeding that to
  downstream programs.
 
* The text representation becomes locale-specific:
 
  [b3:~:105507] LC_NUMERIC=en_US printf "%'10d\n" 505496
     505,496
  [b3:~:105508] LC_NUMERIC=de_AT printf "%'10d\n" 505496
     505.496
 
  Note that the first output would be interpreted as 505496E-3 in the
  de_AT locale, and the second would also be interpreted as 505496E-3
in   the en_US locale.
 
Therefore I think that we need some locale-independent thousands (and
decimal) separators.


Fair enough.



For the decimal separator every programming
language uses ".".


Do they?  I vaguely remember that in COBOL (which was defined before
locale were a thing), if you specified "Decimal is Comma" (I may have
the syntax wrong), then the decimal speparator became the comma.
Perhpa this wasn't brought forward.  But then if you use the period for
the three digits separator and the decimal separator, doesn't that
cause confusion?


For the thousands separator, Ada, C#, D, Eiffel,
Go, Haskell, Java, Julia, Perl, Python3, Ruby, Rust, and Swift use _.
And Gforth, too.
 
In C++, there is a conflict of _ with another feature, so they instead
chose '.  However, C++ is not used interactively, and in a code
generator that generates C++ code, having to replace _ with ' for
generating C++ code is a minor pain.
 
- anton



--
 - Stephen Fuld
(e-mail address disguised to prevent spam)

Date Sujet#  Auteur
1 May 24 * Byte Addressability And Beyond590Lawrence D'Oliveiro
1 May 24 +* Re: Byte Addressability And Beyond431John Levine
1 May 24 i+* Re: Byte Addressability And Beyond409Lawrence D'Oliveiro
1 May 24 ii+* Re: Byte Addressability And Beyond3John Levine
1 May 24 iii+- Re: Byte Addressability And Beyond1John Levine
1 May 24 iii`- Re: Byte Addressability And Beyond1Lawrence D'Oliveiro
1 May 24 ii+- Re: Byte Addressability And Beyond1Michael S
1 May 24 ii`* Re: Byte Addressability And Beyond404John Levine
2 May 24 ii +* Re: Byte Addressability And Beyond382Lawrence D'Oliveiro
2 May 24 ii i+* Re: Byte Addressability And Beyond4John Levine
2 May 24 ii ii`* Re: Byte Addressability And Beyond3Lawrence D'Oliveiro
2 May 24 ii ii `* Re: Byte Addressability And Beyond2John Levine
5 May 24 ii ii  `- Re: Byte Addressability And Beyond1Lawrence D'Oliveiro
2 May 24 ii i+* Re: Byte Addressability And Beyond367John Savard
2 May 24 ii ii+* Re: Byte Addressability And Beyond2MitchAlsup1
11 May 24 ii iii`- Re: Byte Addressability And Beyond1John Savard
4 May 24 ii ii`* Re: Byte Addressability And Beyond364Lawrence D'Oliveiro
8 May 24 ii ii `* Re: Byte Addressability And Beyond363John Savard
8 May 24 ii ii  +* Re: Byte Addressability And Beyond2Lawrence D'Oliveiro
10 May 24 ii ii  i`- Re: Byte Addressability And Beyond1David Brown
8 May 24 ii ii  `* Re: Byte Addressability And Beyond360MitchAlsup1
8 May 24 ii ii   `* Re: Byte Addressability And Beyond359John Levine
8 May 24 ii ii    +* Re: Byte Addressability And Beyond357Lawrence D'Oliveiro
9 May 24 ii ii    i`* Re: Byte Addressability And Beyond356John Levine
10 May 24 ii ii    i +* Re: Byte Addressability And Beyond354David Brown
10 May 24 ii ii    i i`* Re: Byte Addressability And Beyond353Anton Ertl
11 May 24 ii ii    i i `* Re: Byte Addressability And Beyond352David Brown
11 May 24 ii ii    i i  `* Re: Byte Addressability And Beyond351Anton Ertl
11 May 24 ii ii    i i   +* Re: Byte Addressability And Beyond158David Brown
11 May 24 ii ii    i i   i+- Re: Byte Addressability And Beyond1Anton Ertl
27 May 24 ii ii    i i   i`* Re: Byte Addressability And Beyond156Lawrence D'Oliveiro
27 May 24 ii ii    i i   i `* Re: Byte Addressability And Beyond155John Levine
27 May 24 ii ii    i i   i  `* Re: Byte Addressability And Beyond154Lawrence D'Oliveiro
27 May 24 ii ii    i i   i   `* Re: Byte Addressability And Beyond153John Levine
27 May 24 ii ii    i i   i    +* Re: Byte Addressability And Beyond149John Levine
27 May 24 ii ii    i i   i    i+- Re: Byte Addressability And Beyond1MitchAlsup1
28 May 24 ii ii    i i   i    i`* Re: Byte Addressability And Beyond147Lawrence D'Oliveiro
28 May 24 ii ii    i i   i    i +- Re: encoding conversion, Byte Addressability And Beyond1John Levine
28 May 24 ii ii    i i   i    i `* Re: Byte Addressability And Beyond145Thomas Koenig
29 May 24 ii ii    i i   i    i  +* Re: Byte Addressability And Beyond137Lawrence D'Oliveiro
29 May 24 ii ii    i i   i    i  i`* Re: Byte Addressability And Beyond136Anton Ertl
29 May 24 ii ii    i i   i    i  i +* Re: Byte Addressability And Beyond12Stefan Monnier
29 May 24 ii ii    i i   i    i  i i+* Re: Byte Addressability And Beyond10Stefan Monnier
29 May 24 ii ii    i i   i    i  i ii+* Re: Byte Addressability And Beyond3John Levine
30 May 24 ii ii    i i   i    i  i iii`* Re: Byte Addressability And Beyond2George Neuner
4 Jun 24 ii ii    i i   i    i  i iii `- Re: Byte Addressability And Beyond1George Neuner
30 May 24 ii ii    i i   i    i  i ii`* Re: Byte Addressability And Beyond6Anton Ertl
4 Jun 24 ii ii    i i   i    i  i ii +- Re: Byte Addressability And Beyond1Lawrence D'Oliveiro
4 Jun 24 ii ii    i i   i    i  i ii `* Re: Byte Addressability And Beyond4Stefan Monnier
7 Jun 24 ii ii    i i   i    i  i ii  +- Re: Byte Addressability And Beyond1Terje Mathisen
7 Jun 24 ii ii    i i   i    i  i ii  `* Re: Character non-equivalence, was Byte Addressability And Beyond2John Levine
9 Jun 24 ii ii    i i   i    i  i ii   `- Re: Character non-equivalence, was Byte Addressability And Beyond1Lawrence D'Oliveiro
30 May 24 ii ii    i i   i    i  i i`- Re: Byte Addressability And Beyond1Lawrence D'Oliveiro
30 May 24 ii ii    i i   i    i  i +* Re: Byte Addressability And Beyond117Lawrence D'Oliveiro
30 May 24 ii ii    i i   i    i  i i+* Re: architectural goals, Byte Addressability And Beyond66John Levine
30 May 24 ii ii    i i   i    i  i ii+- Re: architectural goals, Byte Addressability And Beyond1Stephen Fuld
30 May 24 ii ii    i i   i    i  i ii+* Re: architectural goals, Byte Addressability And Beyond22Anton Ertl
30 May 24 ii ii    i i   i    i  i iii`* Re: architectural goals, Byte Addressability And Beyond21Thomas Koenig
30 May 24 ii ii    i i   i    i  i iii +* Re: architectural goals, Byte Addressability And Beyond8Michael S
30 May 24 ii ii    i i   i    i  i iii i+- Re: architectural goals, Byte Addressability And Beyond1Thomas Koenig
30 May 24 ii ii    i i   i    i  i iii i+* Re: IBM architectural goals, Byte Addressability And Beyond5John Levine
30 May 24 ii ii    i i   i    i  i iii ii+* Re: IBM architectural goals, Byte Addressability And Beyond2Michael S
30 May 24 ii ii    i i   i    i  i iii iii`- Re: IBM architectural goals, Byte Addressability And Beyond1John Levine
30 May 24 ii ii    i i   i    i  i iii ii`* Re: IBM architectural goals, Byte Addressability And Beyond2Thomas Koenig
30 May 24 ii ii    i i   i    i  i iii ii `- Re: IBM architectural goals, Byte Addressability And Beyond1John Levine
30 May 24 ii ii    i i   i    i  i iii i`- Re: architectural goals, Byte Addressability And Beyond1Anton Ertl
30 May 24 ii ii    i i   i    i  i iii +* Re: architectural goals, Byte Addressability And Beyond3Anton Ertl
30 May 24 ii ii    i i   i    i  i iii i+- Re: architectural goals, Byte Addressability And Beyond1John Levine
30 May 24 ii ii    i i   i    i  i iii i`- Re: architectural goals, Byte Addressability And Beyond1Thomas Koenig
31 May 24 ii ii    i i   i    i  i iii +* Re: architectural goals, Byte Addressability And Beyond5Terje Mathisen
1 Jun 24 ii ii    i i   i    i  i iii i`* Re: architectural goals, Byte Addressability And Beyond4Thomas Koenig
1 Jun 24 ii ii    i i   i    i  i iii i `* Re: architectural goals, Byte Addressability And Beyond3Anton Ertl
2 Jun 24 ii ii    i i   i    i  i iii i  `* Re: architectural goals, Byte Addressability And Beyond2John Levine
4 Jun 24 ii ii    i i   i    i  i iii i   `- Re: architectural goals, Byte Addressability And Beyond1Stefan Monnier
4 Jun 24 ii ii    i i   i    i  i iii `* Re: architectural goals, Byte Addressability And Beyond4Lawrence D'Oliveiro
4 Jun 24 ii ii    i i   i    i  i iii  +- Re: architectural goals, Byte Addressability And Beyond1MitchAlsup1
4 Jun 24 ii ii    i i   i    i  i iii  +- Re: architectural goals, Byte Addressability And Beyond1Lynn Wheeler
4 Jun 24 ii ii    i i   i    i  i iii  `- Re: architectural goals, Byte Addressability And Beyond1Stefan Monnier
31 May 24 ii ii    i i   i    i  i ii`* Re: architectural goals, Byte Addressability And Beyond42John Savard
31 May 24 ii ii    i i   i    i  i ii `* Re: architectural goals, Byte Addressability And Beyond41John Levine
1 Jun 24 ii ii    i i   i    i  i ii  +* Re: architectural goals, Byte Addressability And Beyond31John Savard
1 Jun 24 ii ii    i i   i    i  i ii  i+* Re: architectural goals, Byte Addressability And Beyond20Thomas Koenig
2 Jun 24 ii ii    i i   i    i  i ii  ii+* Re: architectural goals, Byte Addressability And Beyond6John Savard
2 Jun 24 ii ii    i i   i    i  i ii  iii`* Re: architectural goals, Byte Addressability And Beyond5Thomas Koenig
2 Jun 24 ii ii    i i   i    i  i ii  iii +* Re: architectural goals, Byte Addressability And Beyond3John Levine
3 Jun 24 ii ii    i i   i    i  i ii  iii i`* Re: architectural goals, Byte Addressability And Beyond2OrangeFish
3 Jun 24 ii ii    i i   i    i  i ii  iii i `- Re: architectural goals, Byte Addressability And Beyond1John Levine
4 Jun 24 ii ii    i i   i    i  i ii  iii `- Re: architectural goals, Byte Addressability And Beyond1Lawrence D'Oliveiro
4 Jun 24 ii ii    i i   i    i  i ii  ii`* Re: architectural goals, Byte Addressability And Beyond13Lawrence D'Oliveiro
5 Jun 24 ii ii    i i   i    i  i ii  ii `* Re: architectural goals, Byte Addressability And Beyond12Lawrence D'Oliveiro
5 Jun 24 ii ii    i i   i    i  i ii  ii  +- Re: architectural goals, Byte Addressability And Beyond1Lawrence D'Oliveiro
6 Jun 24 ii ii    i i   i    i  i ii  ii  `* Re: architectural goals, Byte Addressability And Beyond10George Neuner
6 Jun 24 ii ii    i i   i    i  i ii  ii   +* Re: architectural goals, Byte Addressability And Beyond6John Levine
7 Jun 24 ii ii    i i   i    i  i ii  ii   i+* Re: architectural goals, Byte Addressability And Beyond4Lawrence D'Oliveiro
7 Jun 24 ii ii    i i   i    i  i ii  ii   ii`* Re: architectural goals, Byte Addressability And Beyond3Stephen Fuld
7 Jun 24 ii ii    i i   i    i  i ii  ii   ii `* Re: architectural goals, Byte Addressability And Beyond2Lawrence D'Oliveiro
7 Jun 24 ii ii    i i   i    i  i ii  ii   ii  `- Re: architectural goals, Byte Addressability And Beyond1Stephen Fuld
7 Jun 24 ii ii    i i   i    i  i ii  ii   i`- Re: architectural goals, Byte Addressability And Beyond1Terje Mathisen
6 Jun 24 ii ii    i i   i    i  i ii  ii   +- Re: architectural goals, Byte Addressability And Beyond1Lynn Wheeler
6 Jun 24 ii ii    i i   i    i  i ii  ii   +- Re: architectural goals, Byte Addressability And Beyond1OrangeFish
7 Jun 24 ii ii    i i   i    i  i ii  ii   `- Re: architectural goals, Byte Addressability And Beyond1Lawrence D'Oliveiro
2 Jun 24 ii ii    i i   i    i  i ii  i`* Re: architectural goals, Byte Addressability And Beyond10John Dallman
2 Jun 24 ii ii    i i   i    i  i ii  +- Re: architectural goals, Byte Addressability And Beyond1Michael S
2 Jun 24 ii ii    i i   i    i  i ii  +- Re: architectural goals, Byte Addressability And Beyond1John Dallman
4 Jun 24 ii ii    i i   i    i  i ii  `* Re: architectural goals, Byte Addressability And Beyond7Lawrence D'Oliveiro
30 May 24 ii ii    i i   i    i  i i+* Re: Byte Addressability And Beyond49Stephen Fuld
30 May 24 ii ii    i i   i    i  i i`- Re: Byte Addressability And Beyond1Anton Ertl
30 May 24 ii ii    i i   i    i  i +* Re: Byte Addressability And Beyond2Lawrence D'Oliveiro
30 May 24 ii ii    i i   i    i  i `* Re: Byte Addressability And Beyond4Terje Mathisen
30 May 24 ii ii    i i   i    i  `* Re: Byte Addressability And Beyond7Terje Mathisen
28 May 24 ii ii    i i   i    `* Re: Byte Addressability And Beyond3Lawrence D'Oliveiro
12 May 24 ii ii    i i   +* Re: python text, Byte Addressability And Beyond14John Levine
12 May 24 ii ii    i i   `* Re: Byte Addressability And Beyond178Thomas Koenig
27 May 24 ii ii    i `- Re: Byte Addressability And Beyond1Lawrence D'Oliveiro
8 May 24 ii ii    `- Re: Byte Addressability And Beyond1Michael S
2 May 24 ii i`* Re: Byte Addressability And Beyond10MitchAlsup1
2 May 24 ii +* Re: Byte Addressability And Beyond3Michael S
2 May 24 ii `* Re: Byte Addressability And Beyond18Anton Ertl
1 May 24 i+* Byte Order (was: Byte Addressability And Beyond)4Anton Ertl
1 May 24 i`* Re: Byte Addressability And Beyond17Stefan Monnier
1 May 24 +* Re: Byte Addressability And Beyond40MitchAlsup1
1 May 24 +* Re: Byte Addressability And Beyond15Thomas Koenig
1 May 24 +* Re: Byte Addressability And Beyond3Michael S
2 May 24 +* Re: Byte Addressability And Beyond4Lawrence D'Oliveiro
3 May 24 +* Re: Byte Addressability And Beyond75Anton Ertl
5 May 24 +* Re: Byte Addressability And Beyond20John Savard
5 May 24 `- Re: Byte Addressability And Beyond1John Savard

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal