Ted Nolan <tednolan> <
t...@loft.tnolan.com> wrote:
> In article <u9efpk$3brt2$
2...@dont-email.me>,
> Ashok <
apnmbx...@yahoo.com> wrote:
>>With respect to your first question, no the string representation will
>>not shimmer away. This is no different than "set x 0x10" and worrying
>>about the string shimmering to "16" (assuming no arithmetic operations
>>are applied of course).
>>
>>With respect to the second, the "string is integer" identifies what
>>strings are accepted by *Tcl* as integer, not humans. Since 1_234 is
>>always acceptable the command will return 1 irrespective of -strict.
>>
>>As to -strict being the default in Tcl 9, I think that ship has sailed.
>>Iirc, it would have too much impact on Tk.
>>
>>/Ashok
>>
>
> I'm curious how this feature was motivated. Does any other language use
> this notation?
At least one other language is Python:
https://peps.python.org/pep-0515/
Whether Python's usage motivated this change for Tcl I cannot say.
> Perhaps I'm missing something, but to me it looks like a solution in
> search of a problem, and something likely to have unintended
> consequences.
>
> Or maybe I'm missing something.
The intent appears to be to allow for a locale independent "thousands
separator" for long integer constants.
Instead of 17283747283748234
One can write 17_283_747_283_748_234
Also, according to the Phython PEP, the following other languages have
similar allowances for "thousand's separators":
Ada: single, only between digits [8]
C# (open proposal for 7.0): multiple, only between digits [6]
C++14: single, between digits (different separator chosen) [1]
D: multiple, anywhere, including trailing [2]
Java: multiple, only between digits [7]
Julia: single, only between digits (but not in float exponent parts) [9]
Perl 5: multiple, basically anywhere, although docs say it’s
restricted to one underscore between digits [3]
Ruby: single, only between digits (although docs say “anywhere”) [10]
Rust: multiple, anywhere, except for between exponent “e” and digits [4]
Swift: multiple, between digits and trailing (although textual
description says only “between digits”) [5]