Check-in [78a116deef]

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added TIP 551 - underscores in numeric literals
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 78a116deef4b2e27309d87e794b9abbffccfe2fd489d78db9fbbf434e401c27b
User & Date: griffin 2019-09-16 15:29:52
Context
2019-09-16
15:34
format cleanup in TIP 551 check-in: 92d93435a6 user: griffin tags: trunk
15:29
Added TIP 551 - underscores in numeric literals check-in: 78a116deef user: griffin tags: trunk
2019-09-14
22:05
Record votes for TIP #414 and #548 check-in: b9eb2c1961 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to index.json.

1

2
3
4
5
6
7
8
...
547
548
549
550
551
552
553
554
555
{"tip": {

	"550":{"url":"./tip/550.md","keywords":"Tcl, memory","created":"11-Jun-2019","post-history":"","state":"Draft","tcl-version":"9.0","vote":"Pending","type":"Project","title":"# TIP 550: Garbage Collection for TclOO","author":["Donal K. Fellows <[email protected]>"],"is-jest":false},
	"549":{"url":"./tip/549.md","keywords":"Tcl","created":"7-June-2019","post-history":"","state":"Draft","tcl-branch":"tip-549","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 549: Make configure --enable-64bit the default","discussions-to":"Tcl Core list","author":["Jan Nijtmans <[email protected]>","Jan Nijtmans <[email protected]>"],"is-jest":false},
	"548":{"url":"./tip/548.md","keywords":"Tcl","state":"Final","type":"Project","author":["Jan Nijtmans <[email protected]>","Jan Nijtmans <[email protected]>"],"votes-against":"none","votes-for":"JN, DKF, KW, KBK","vote-results":"4/2/0 accepted","created":"3-June-2019","title":"# TIP 548:Support `wchar_t` conversion functions and deprecate `Tcl_WinUtfToTChar()` and `Tcl_WinTCharToUtf()`","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-548","votes-present":"DGP, SL","discussions-to":"Tcl Core list","is-jest":false},
	"547":{"url":"./tip/547.md","keywords":"Tcl","created":"31-May-2019","post-history":"","state":"Final","tcl-branch":"tip-547","tcl-version":"8.7","vote":"Done","type":"Project","title":"# TIP 547: New encodings: UTF-16, UCS-2","discussions-to":"Tcl Core list","author":["Jan Nijtmans <[email protected]>","Jan Nijtmans <[email protected]>"],"is-jest":false},
	"546":{"url":"./tip/546.md","keywords":"Tcl, traces","created":"20-May-2019","post-history":"","state":"Draft","vote":"Pending","tcl-version":"8.7","type":"Project","title":"# TIP 546: Typedefs to Support Source-Compatible Migration","author":["Don Porter <[email protected]>"],"is-jest":false},
	"545":{"url":"./tip/545.md","keywords":"Tk, image","state":"Final","type":"Project","tk-branch":"tip-545-svg-options","author":["Harald Oehlmann <[email protected]>"],"vote-results":"6/0/0 accepted","votes-for":"BG, DKF, FV, KW, JN, MC","votes-against":"none","created":"19-May-2019","title":"# TIP 545: image photo SVG options: remove -unit and add target height/width option","vote":"Done","tcl-version":"8.7","votes-present":"none","is-jest":false},
	"544":{"url":"./tip/544.md","keywords":"Tcl","created":"15-May-2019","post-history":"","state":"Final","tcl-branch":"tip-544","vote":"Done","tcl-version":"8.7","type":"Project","title":"# TIP 544: Export TclGetIntForIndex()","discussions-to":"Tcl Core list","author":["Jan Nijtmans <[email protected]>","Fran├žois Vogel <[email protected]>"],"is-jest":false},
................................................................................
	"5":{"url":"./tip/5.md","created":"17-Oct-2000","post-history":"","state":"Final","vote":"Done","tcl-version":"8.4","type":"Project","title":"# TIP 5: Make TkClassProcs and TkSetClassProcs Public and Extensible","author":["Eric Melski <[email protected]>"],"is-jest":false},
	"4":{"url":"./tip/4.md","created":"26-Oct-2000","post-history":"","state":"Draft","vote":"Pending","type":"Informative","title":"# TIP 4: Tcl Release and Distribution Philosophy","discussions-to":"news:comp.lang.tcl","author":["Brent Welch <[email protected]>","Donal K. Fellows <[email protected]>","Larry W. Virden <[email protected]>","Larry W. Virden <[email protected]>"],"is-jest":false},
	"3":{"url":"./tip/3.md","created":"14-Sep-2000","obsoleted-by":"467","post-history":"","state":"Accepted","vote":"Done","type":"Process","title":"# TIP 3: TIP Format","author":["Andreas Kupries <[email protected]>","Donal K. Fellows <[email protected]>"],"is-jest":false},
	"2":{"url":"./tip/2.md","created":"12-Sep-2000","post-history":"","state":"Draft","vote":"Pending","type":"Process","title":"# TIP 2: TIP Guidelines","author":["Andreas Kupries <[email protected]>","Donal K. Fellows <[email protected]>","Don Porter <[email protected]>","Mo DeJong <[email protected]>","Larry W. Virden <[email protected]>","Kevin Kenny <[email protected]>"],"is-jest":false},
	"1":{"url":"./tip/1.md","created":"14-Sep-2000","obsoleted-by":"386","post-history":"","state":"Withdrawn","vote":"No voting","type":"Informational","title":"# TIP 1: TIP Index","author":["TIP Editor <[email protected]>"],"is-jest":false},
	"0":{"url":"./tip/0.md","created":"11-Dec-2000","post-history":"","state":"Final","vote":"Done","type":"Process","title":"# TIP 0: Tcl Core Team Basic Rules","author":["John Ousterhout <[email protected]>"],"is-jest":false},
	"@min": 0,
	"@max": 550
}, "@timestamp": 1568498629}
>







 







|
|
1
2
3
4
5
6
7
8
9
...
548
549
550
551
552
553
554
555
556
{"tip": {
	"551":{"url":"./tip/551.md","keywords":"numbers, readability","":"","state":"Draft","type":"Project","author":["[email protected]"],"created":"16-Sep-2019","title":"# TIP 551: permit underscore in numerical literals in source code","sponsor":"Brian Griffin <[email protected]>","post-history":"","vote":"Pending","tcl-version":"8.7","char c = len ? *p ":"'\\0';","is-jest":false},
	"550":{"url":"./tip/550.md","keywords":"Tcl, memory","created":"11-Jun-2019","post-history":"","state":"Draft","tcl-version":"9.0","vote":"Pending","type":"Project","title":"# TIP 550: Garbage Collection for TclOO","author":["Donal K. Fellows <[email protected]>"],"is-jest":false},
	"549":{"url":"./tip/549.md","keywords":"Tcl","created":"7-June-2019","post-history":"","state":"Draft","tcl-branch":"tip-549","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 549: Make configure --enable-64bit the default","discussions-to":"Tcl Core list","author":["Jan Nijtmans <[email protected]>","Jan Nijtmans <[email protected]>"],"is-jest":false},
	"548":{"url":"./tip/548.md","keywords":"Tcl","state":"Final","type":"Project","author":["Jan Nijtmans <[email protected]>","Jan Nijtmans <[email protected]>"],"votes-against":"none","votes-for":"JN, DKF, KW, KBK","vote-results":"4/2/0 accepted","created":"3-June-2019","title":"# TIP 548:Support `wchar_t` conversion functions and deprecate `Tcl_WinUtfToTChar()` and `Tcl_WinTCharToUtf()`","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-548","votes-present":"DGP, SL","discussions-to":"Tcl Core list","is-jest":false},
	"547":{"url":"./tip/547.md","keywords":"Tcl","created":"31-May-2019","post-history":"","state":"Final","tcl-branch":"tip-547","tcl-version":"8.7","vote":"Done","type":"Project","title":"# TIP 547: New encodings: UTF-16, UCS-2","discussions-to":"Tcl Core list","author":["Jan Nijtmans <[email protected]>","Jan Nijtmans <[email protected]>"],"is-jest":false},
	"546":{"url":"./tip/546.md","keywords":"Tcl, traces","created":"20-May-2019","post-history":"","state":"Draft","vote":"Pending","tcl-version":"8.7","type":"Project","title":"# TIP 546: Typedefs to Support Source-Compatible Migration","author":["Don Porter <[email protected]>"],"is-jest":false},
	"545":{"url":"./tip/545.md","keywords":"Tk, image","state":"Final","type":"Project","tk-branch":"tip-545-svg-options","author":["Harald Oehlmann <[email protected]>"],"vote-results":"6/0/0 accepted","votes-for":"BG, DKF, FV, KW, JN, MC","votes-against":"none","created":"19-May-2019","title":"# TIP 545: image photo SVG options: remove -unit and add target height/width option","vote":"Done","tcl-version":"8.7","votes-present":"none","is-jest":false},
	"544":{"url":"./tip/544.md","keywords":"Tcl","created":"15-May-2019","post-history":"","state":"Final","tcl-branch":"tip-544","vote":"Done","tcl-version":"8.7","type":"Project","title":"# TIP 544: Export TclGetIntForIndex()","discussions-to":"Tcl Core list","author":["Jan Nijtmans <[email protected]>","Fran├žois Vogel <[email protected]>"],"is-jest":false},
................................................................................
	"5":{"url":"./tip/5.md","created":"17-Oct-2000","post-history":"","state":"Final","vote":"Done","tcl-version":"8.4","type":"Project","title":"# TIP 5: Make TkClassProcs and TkSetClassProcs Public and Extensible","author":["Eric Melski <[email protected]>"],"is-jest":false},
	"4":{"url":"./tip/4.md","created":"26-Oct-2000","post-history":"","state":"Draft","vote":"Pending","type":"Informative","title":"# TIP 4: Tcl Release and Distribution Philosophy","discussions-to":"news:comp.lang.tcl","author":["Brent Welch <[email protected]>","Donal K. Fellows <[email protected]>","Larry W. Virden <[email protected]>","Larry W. Virden <[email protected]>"],"is-jest":false},
	"3":{"url":"./tip/3.md","created":"14-Sep-2000","obsoleted-by":"467","post-history":"","state":"Accepted","vote":"Done","type":"Process","title":"# TIP 3: TIP Format","author":["Andreas Kupries <[email protected]>","Donal K. Fellows <[email protected]>"],"is-jest":false},
	"2":{"url":"./tip/2.md","created":"12-Sep-2000","post-history":"","state":"Draft","vote":"Pending","type":"Process","title":"# TIP 2: TIP Guidelines","author":["Andreas Kupries <[email protected]>","Donal K. Fellows <[email protected]>","Don Porter <[email protected]>","Mo DeJong <[email protected]>","Larry W. Virden <[email protected]>","Kevin Kenny <[email protected]>"],"is-jest":false},
	"1":{"url":"./tip/1.md","created":"14-Sep-2000","obsoleted-by":"386","post-history":"","state":"Withdrawn","vote":"No voting","type":"Informational","title":"# TIP 1: TIP Index","author":["TIP Editor <[email protected]>"],"is-jest":false},
	"0":{"url":"./tip/0.md","created":"11-Dec-2000","post-history":"","state":"Final","vote":"Done","type":"Process","title":"# TIP 0: Tcl Core Team Basic Rules","author":["John Ousterhout <[email protected]>"],"is-jest":false},
	"@min": 0,
	"@max": 551
}, "@timestamp": 1568647647}

Changes to index.md.

203
204
205
206
207
208
209








210
211
212
213
214
215
216
<th>Type</th>
<th>Tcl Version</th>
<th>Status</th>
<th>Title</th>
<th>Impl.</th>
</tr></thead><tbody>









<tr class='state-draft type-project version-90'>
<td valign='top'><a href='./tip/550.md'>550</a></td>
<td valign='top'>Project</td>
<td valign='top'>9.0</td>
<td valign='top'>Draft</td>
<td valign='top' ><a href='./tip/550.md'>Garbage Collection for TclOO</a></td>
<td></td>






>
>
>
>
>
>
>
>







203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<th>Type</th>
<th>Tcl Version</th>
<th>Status</th>
<th>Title</th>
<th>Impl.</th>
</tr></thead><tbody>

<tr class='state-draft type-project version-87'>
<td valign='top'><a href='./tip/551.md'>551</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top' ><a href='./tip/551.md'>permit underscore in numerical literals in source code</a></td>
<td></td>
</tr>
<tr class='state-draft type-project version-90'>
<td valign='top'><a href='./tip/550.md'>550</a></td>
<td valign='top'>Project</td>
<td valign='top'>9.0</td>
<td valign='top'>Draft</td>
<td valign='top' ><a href='./tip/550.md'>Garbage Collection for TclOO</a></td>
<td></td>

Added tip/551.md.


















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# TIP 551: permit underscore in numerical literals in source code
    Author:        [email protected]
    State:         Draft
    Type:          Project
    Vote:          Pending
    Created:       16-Sep-2019
    Post-History:
    Tcl-Version:   8.7
    Keywords:      numbers, readability
    Sponsor:       Brian Griffin <[email protected]>
    
# Abstract

This TIP proposes that all numbers in scripts shall allow underscores
for readability of code.

# Rationale and Discussion

In most modern programming languages, it is possible to group the
digits in the program's source code to make it easier to read; Ada, C#
(from version 7.0), D, Haskell (from GHC version 8.6.1), Java, OCaml,
Perl, Python (from version 3.6), Ruby, Rust, and Swift all use the
underscore (`_`) character for this purpose. All these languages allow
nine hundred million to be entered as `900_000_000`.

This TIP proposes to change TCL to include this ability.

# Specification

To allow underscore in numerical constants (decimal, octal, 0x... 0b...
0d... and 0...) the underscore character would be simply an aid to
visibility. This character would serve as a comment in the sense it
would be allowed in the program source code but have no semantic
affect. Any number of underscores would be allowed and their positions
would be unrestricted except where a number would no longer be a
number.

For example,

    `expr 100_000_000`
    `expr 0xffff_ffff`
    `expr 0b1111_1111_1111_1110`

A number is identified in the routine TclParseNumber and scans the
text until the end of the number. It accepts several formats. The key
is that a number is a word that begins with a decimal digit and can
have several forms for decimal, octal, hexidecimal, and binary. The
convention is now to use a 2 character prefix, 0x, 0b, 0o, and the
newest one, 0d. This proposal would allow an underscore following the
first digit or the letter that designates the number base, to anywhere
up to and including the end of the number. There can be multiple
underscores in a row.

Thus,

    `0x_ffff_ffff_`

would be legal and similarly with the other 3 bases supported.

The one restriction would be a number with a leading `_` as that would
change the meaning from a number to a bareword, e.g.

    `expr _123`

would not be allowed, since that would not be a number.

The implementation would be to simply bypass the `_` in all cases during
the processing of the number in the routine TclParseNumber.

The implementation was tested with 4 lines of code at the beginning of
the function. It is at the main while loop in TclParseNumber and
includes this,


    while (1) {
      char c = len ? *p : '\0';
    
      // ------------- add this to allow _ in a number and just bypass it
      if ( c == '_' ) {
        p++;
        continue;
      }
      // -------------- end of code to allow underscore
      ...
    }

# Copyright

This document has been placed in the public domain.