Check-in [a0bb34c204]

Login
FlightAware bounty program for improvements to Tcl and certain Tcl packages.

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

Overview
Comment:New TIP #514 (just raw concept yet). Clarifications for TIP #494
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:a0bb34c2042ff06bf83b3946f2cf4f66541d21a2c56a9cd75d34774b86a545cb
User & Date: jan.nijtmans 2018-08-21 06:57:04
Context
2018-08-21
07:25
Re-generate index check-in: 15a89a0458 user: jan.nijtmans tags: trunk
06:57
New TIP #514 (just raw concept yet). Clarifications for TIP #494 check-in: a0bb34c204 user: jan.nijtmans tags: trunk
2018-07-30
15:40
Fix obsolete email address check-in: e976e75bed user: jan.nijtmans tags: trunk
Changes

Changes to index.json.

1

2
3
4
5
6
7
8
...
510
511
512
513
514
515
516
517
518
{"tip": {

	"513":{"url":"./tip/513.md","keywords":"Tcl,data structure","created":"02-Aug-2017","post-history":"","state":"Draft","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 513: Better support for 'agendas' as arrays, dictionaries or lists","author":["Florian Murr <florian.murr@siemens.com>"],"is-jest":false},
	"512":{"url":"./tip/512.md","keywords":"Tcl","created":"25-June-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 512: No stub for Tcl_SetExitProc()","author":["Jan Nijtmans <jan.nijtmans@gmail.com>"],"is-jest":false},
	"511":{"url":"./tip/511.md","keywords":"Tcl,threads","created":"14-June-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 511: Implement Tcl_AsyncMarkFromSignal()","author":["Christian Werner <undroidwish@googlemail.com>"],"is-jest":false},
	"510":{"url":"./tip/510.md","keywords":"Tk","created":"5-Jun-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"","type":"Project","title":"# TIP 510: Add Rbc to Tk","author":["René Zaumseil <r.zaumseil@freenet.de>"],"is-jest":false},
	"509":{"url":"./tip/509.md","keywords":"Tcl,threads","created":"24-May-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"","type":"Project","title":"# TIP 509: Implement reentrant mutexes on all platforms","author":["Frédéric Bonnet <fredericbonnet@free.fr>"],"is-jest":false},
	"508":{"url":"./tip/508.md","keywords":"Tcl,array","created":"13-May-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"","type":"Project","title":"# TIP 508: New subcommand [array default]","author":["Frédéric Bonnet <fredericbonnet@free.fr>"],"is-jest":false},
	"507":{"url":"./tip/507.md","keywords":"Tk","created":"9-May-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"","type":"Project","title":"# TIP 507: Include simple svg support with nanosvg","author":["René Zaumseil <r.zaumseil@freenet.de>"],"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 <ericm@ajubasolutions.com>"],"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 <welch@acm.org>","Donal K. Fellows <fellowsd@cs.man.ac.uk>","Larry W. Virden <lvirden@cas.org>","Larry W. Virden <lvirden@yahoo.com>"],"is-jest":false},
	"3":{"url":"./tip/3.md","created":"14-Sep-2000","post-history":"","state":"Accepted","vote":"Done","type":"Process","title":"# TIP 3: TIP Format","author":["Andreas Kupries <a.kupries@westend.com>","Donal K. Fellows <fellowsd@cs.man.ac.uk>"],"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 <a.kupries@westend.com>","Donal K. Fellows <fellowsd@cs.man.ac.uk>","Don Porter <dgp@users.sourceforge.net>","Mo DeJong <no@spam.com>","Larry W. Virden <lvirden@yahoo.com>","Kevin Kenny <kennykb@acm.org>"],"is-jest":false},
	"1":{"url":"./tip/1.md","created":"14-Sep-2000","post-history":"","state":"Active","vote":"No voting","type":"Informational","title":"# TIP 1: TIP Index","author":["TIP Editor <donal.fellows@cs.man.ac.uk>"],"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 <ouster@pacbell.net>"],"is-jest":false},
	"@min": 0,
	"@max": 513
}, "@timestamp": 1532965107}

>







 







|
|
1
2
3
4
5
6
7
8
9
...
511
512
513
514
515
516
517
518
519
{"tip": {
	"514":{"url":"./tip/514.md","keywords":"Tcl","created":"25-June-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 512: No stub for Tcl_SetExitProc()","author":["Jan Nijtmans <jan.nijtmans@gmail.com>"],"is-jest":false},
	"513":{"url":"./tip/513.md","keywords":"Tcl,data structure","created":"02-Aug-2017","post-history":"","state":"Draft","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 513: Better support for 'agendas' as arrays, dictionaries or lists","author":["Florian Murr <florian.murr@siemens.com>"],"is-jest":false},
	"512":{"url":"./tip/512.md","keywords":"Tcl","created":"25-June-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 512: No stub for Tcl_SetExitProc()","author":["Jan Nijtmans <jan.nijtmans@gmail.com>"],"is-jest":false},
	"511":{"url":"./tip/511.md","keywords":"Tcl,threads","created":"14-June-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 511: Implement Tcl_AsyncMarkFromSignal()","author":["Christian Werner <undroidwish@googlemail.com>"],"is-jest":false},
	"510":{"url":"./tip/510.md","keywords":"Tk","created":"5-Jun-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"","type":"Project","title":"# TIP 510: Add Rbc to Tk","author":["René Zaumseil <r.zaumseil@freenet.de>"],"is-jest":false},
	"509":{"url":"./tip/509.md","keywords":"Tcl,threads","created":"24-May-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"","type":"Project","title":"# TIP 509: Implement reentrant mutexes on all platforms","author":["Frédéric Bonnet <fredericbonnet@free.fr>"],"is-jest":false},
	"508":{"url":"./tip/508.md","keywords":"Tcl,array","created":"13-May-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"","type":"Project","title":"# TIP 508: New subcommand [array default]","author":["Frédéric Bonnet <fredericbonnet@free.fr>"],"is-jest":false},
	"507":{"url":"./tip/507.md","keywords":"Tk","created":"9-May-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"","type":"Project","title":"# TIP 507: Include simple svg support with nanosvg","author":["René Zaumseil <r.zaumseil@freenet.de>"],"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 <ericm@ajubasolutions.com>"],"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 <welch@acm.org>","Donal K. Fellows <fellowsd@cs.man.ac.uk>","Larry W. Virden <lvirden@cas.org>","Larry W. Virden <lvirden@yahoo.com>"],"is-jest":false},
	"3":{"url":"./tip/3.md","created":"14-Sep-2000","post-history":"","state":"Accepted","vote":"Done","type":"Process","title":"# TIP 3: TIP Format","author":["Andreas Kupries <a.kupries@westend.com>","Donal K. Fellows <fellowsd@cs.man.ac.uk>"],"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 <a.kupries@westend.com>","Donal K. Fellows <fellowsd@cs.man.ac.uk>","Don Porter <dgp@users.sourceforge.net>","Mo DeJong <no@spam.com>","Larry W. Virden <lvirden@yahoo.com>","Kevin Kenny <kennykb@acm.org>"],"is-jest":false},
	"1":{"url":"./tip/1.md","created":"14-Sep-2000","post-history":"","state":"Active","vote":"No voting","type":"Informational","title":"# TIP 1: TIP Index","author":["TIP Editor <donal.fellows@cs.man.ac.uk>"],"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 <ouster@pacbell.net>"],"is-jest":false},
	"@min": 0,
	"@max": 514
}, "@timestamp": 1534776157}

Changes to index.md.

115
116
117
118
119
120
121







122
123
124
125
126
127
128
<th>#</th>
<th>Type</th>
<th>Tcl Version</th>
<th>Status</th>
<th>Title</th>
</tr></thead><tbody>








<tr class='project projectdraft projectdraft87 project87'>
<td valign='top'><a href='./tip/513.md'>513</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 513: Better support for &apos;agendas&apos; as arrays, dictionaries or lists</td>
</tr>







>
>
>
>
>
>
>







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<th>#</th>
<th>Type</th>
<th>Tcl Version</th>
<th>Status</th>
<th>Title</th>
</tr></thead><tbody>

<tr class='project projectdraft projectdraft87 project87'>
<td valign='top'><a href='./tip/514.md'>514</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 512: No stub for Tcl_SetExitProc()</td>
</tr>
<tr class='project projectdraft projectdraft87 project87'>
<td valign='top'><a href='./tip/513.md'>513</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 513: Better support for &apos;agendas&apos; as arrays, dictionaries or lists</td>
</tr>

Changes to tip/494.md.

21
22
23
24
25
26
27
28
29





30
31
32
33
34






































35
36
37
38
39
40
41
42
43

  * Enhance the hash functions, such that the hash value is stored in a size\_t in stead of unsigned int. This allows hash tables to grow beyond 4Gb on 64-bit platforms

  * Enhance all struct fields representing refCounts or epochs, make them of type size_t

  * All memory-related functions, such as Tcl\_Alloc\(\), will change its size argument from _int_ to _size\_t_, and its "char *" arguments to "void *"
  
  * Many functions, which have size parameters of type _int_ (but NOT _int_ *) will change to type size\_t






  * On 32-bit platforms, this is all 100% upwards binary compatible, provided no _internal_ API is used (since some internal structs has incompatible but externally invisible changes)

  * On 64-bit platforms, those changes cause binary incompatibility, but source compatibility is retained. Therefore the TCL_MAGIC value needs to change, so extensions compiled using Tcl 9 headers will not load in Tcl 8 and reverse.

TODO explain changes in more detail.







































# Implementation

An implementation of this TIP can be found in the [memory-API branch]
(https://core.tcl.tk/tcl/timeline?r=memory-API). (still in development)

# Copyright

This document has been placed in the public domain.







|

>
>
>
>
>
|

|

<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



|
|




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

  * Enhance the hash functions, such that the hash value is stored in a size\_t in stead of unsigned int. This allows hash tables to grow beyond 4Gb on 64-bit platforms

  * Enhance all struct fields representing refCounts or epochs, make them of type size_t

  * All memory-related functions, such as Tcl\_Alloc\(\), will change its size argument from _int_ to _size\_t_, and its "char *" arguments to "void *"
  
  * Many functions, which have size parameters of type _int_ (but NOT _int *_) will change to type _size\_t_

  * All _ClientData_ type arguments will be changed to _void *_ arguments. This is actually the same type, but it prevents the need for type-casts in some situations.

  * Provide a compilation option -D_TCL\_8\_COMPAT_, which provides fully source compatibility. Using this option, extensions compile and run fine using either Tcl 8 or Tcl 9 headers.
    More explanation below.

On 32-bit platforms, this is all 100% upwards binary compatible, provided no _internal_ API is used (since some internal structs might have incompatible but externally invisible changes)

On 64-bit platforms, those changes cause binary incompatibility. Therefore the TCL_MAGIC value needs to change, so extensions compiled using Tcl 9 headers will not load in Tcl 8 and reverse.



# Implications

Although those changes are binary compatible on 32-bit platforms, there is a small potential source incompatibility.
There are 10 functions which previously had an _int_ return argument, which is changed to _size\_t_. This signed/unsigned change might lead to subtle difference in behavior.

The 10 functions are:

  * Tcl_Gets

  * Tcl_GetsObj

  * Tcl_Read

  * Tcl_ReadChars

  * Tcl_ReadRaw

  * Tcl_Write

  * Tcl_WriteChars

  * Tcl_WriteObj

  * Tcl_WriteRaw

  * Tcl_Ungets

If the return value of such function is directly used in a compare, this could lead to the use of an unsigned compare in stead of a signed compare.
If you compile your extension with -D_TCL\_8\_COMPAT_, those 10 functions will be changed to wrapper macro's which makes everything behave as if those functions return Tcl_WideInt. That's the easiest way to resolve this potential problem.

There are 2 other ways to make this change, which can do it without the use of the _TCL\_8\_COMPAT_ macro:

  * Add _1_ to the left and right hand side of the comparison. E.g. [as here](https://core.tcl.tk/tk/fdiff?v1=100235897e9cf359&v2=9cf86629040df0d3)

  * Don't compare to -1 using < or >, but only using == or !=. You can get rid of the compiler warning using casts to _size\_t_. E.g. [as here](https://core.tcl.tk/tk/fdiff?v1=207c608cec63f8f0&v2=e2e5d2322beea420)

Tk and sqlite are already converted to make full use of TIP #494. Other extensions included with Tcl (e.g. tdbc) are unaffected.

# Implementation

The implementation of this TIP can be found in the [memory-API branch]
(https://core.tcl.tk/tcl/timeline?r=memory-API).

# Copyright

This document has been placed in the public domain.

Added tip/514.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
# TIP 514: Platform differences in handling int/wide
	Author:         Jan Nijtmans <jan.nijtmans@gmail.com>
	State:          Draft
	Type:           Project
	Vote:           Pending
	Created:        20-Aug-2018
	Post-History:   
	Keywords:       Tcl
	Tcl-Version:	8.7
-----

# Abstract

This TIP proposes to resolve the platform differences between int/wide math functions and commands like "sting is integer"/"string is wide".
At the script level it should not be relevant whether the platform is 32-bit or 64-bit any more.

Originally, the int() math function was meant to be provide compatibility when introducing big integers using the libtommath library.
Code depending on the modulo behavior of all expressions could use the int() function to make the behavior the same as in Tcl 8.4 again.

# Rationale

TODO

# Specification

 * On all platforms, the int() math function will do 64-bit truncation. This means that on 64-bit Linux (for example)
   nothing changes, but on 32-bit Linux and on Windows the behavior will be exactly the same as on 64-bit Linux.
   int() will become synonym for wide(). The wide() function will become deprecated in Tcl 9.0, but it will not be
   removed yet.

 * The range of "string is integer" is changed to match the range of the int() math function. So this function will report
   true if the number is in the range -9223372036854775808..9223372036854775807. The "string is wideinteger" command will
   be deprecated in Tcl 9.0, but it will not be removed yet.

 * The C function Tcl_GetIntFromObj() will be changed to return TCL_OK if the Tcl_Obj contains values in the range of 2147483648..4294967295. So,
   it succeeds if the number fits in either a platform "int", either a platform "unsigned int" type.

# Implementation

Currently, the proposed implementation is available in [all-wideint branch]
(https://core.tcl.tk/tcl/timeline?r=all-wideint). (WIP)

# Copyright

This document has been placed in the public domain.