Check-in [04c80b80d0]

Login

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

Overview
Comment:Added TIP 531, with apologies to Shannon Noe for taking so long to get this in
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 04c80b80d0741a52196d9cce8ad291e42fe6e4047f3dac4612745d36fc303fd3
User & Date: dkf 2019-01-01 17:05:08.460
Context
2019-01-01
17:07
fix for markdown dialect check-in: 6fc9ac29eb user: dkf tags: trunk
17:05
Added TIP 531, with apologies to Shannon Noe for taking so long to get this in check-in: 04c80b80d0 user: dkf tags: trunk
2018-12-18
17:07
TIP529: worded next insights: property functions and new call functions check-in: 5376cf14bc user: oehhar tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to index.json.
1


2
3
4
5
6
7
8
{"tip": {


	"529":{"url":"./tip/529.md","keywords":"Tk, image","created":"07-Dec-2018","state":"Draft","tk-branch":"tip-529-image-metadata","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 529: Add metadata dict property to tk photo image","author":["Harald Oehlmann <[email protected]>"],"is-jest":false},
	"528":{"url":"./tip/528.md","created":"05-Dec-2018","post-history":"","state":"Draft","tk-branch":"offsetof","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 528: Deprecate Tk_Offset()","author":["Jan Nijtmans <[email protected]>"],"is-jest":false},
	"527":{"url":"./tip/527.md","created":"26-Nov-2018","post-history":"","state":"Draft","tcl-branch":"sebres-8-6-timerate","tcl-version":"8.5","vote":"Pending","type":"Project","title":"# TIP 527: New measurement facilities in TCL: New command timerate.","discussions-to":"news:comp.lang.tcl","author":["Sergey G. Brester <[email protected]>"],"is-jest":false},
	"526":{"url":"./tip/526.md","created":"08-Nov-2018","post-history":"","state":"Draft","tcl-version":"9.0","vote":"Pending","type":"Project","title":"# TIP 526: Make [expr] Only Accept One Argument","author":["Donal K. Fellows <[email protected]>"],"is-jest":false},
	"525":{"url":"./tip/525.md","keywords":"Tcl, testing, continuous integration","state":"Final","type":"Project","author":["Donal K. Fellows <[email protected]>"],"vote-results":"8/0/0 accepted","votes-for":"KBK, SL, AF, DGP, FV, DKF, AK, JN","votes-against":"none","created":"24-Oct-2018","title":"# TIP 525: Make Tcltest Report Overall Success in a Machine-Readable Way","post-history":"","vote":"Done","tcl-version":"8.5","votes-present":"none","is-jest":false},
	"524":{"url":"./tip/524.md","keywords":"Tcl, object orientation, customization","state":"Final","vote-summary":"Accepted 2/0/4","type":"Project","author":["Donal K. Fellows <[email protected]>"],"votes-against":"none","votes-for":"DKF, JN","created":"23-Oct-2018","title":"# TIP 524: Custom Definition Dialects for TclOO","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-524","votes-present":"BG, KBK, FV, SL","is-jest":false},
	"523":{"url":"./tip/523.md","keywords":"queue, stack, pop","state":"Final","vote-summary":"Accepted 7/0/0","type":"Project","author":["Peter Spjuth <[email protected]>"],"votes-against":"none","votes-for":"DKF, BG, KBK, JN, DGP, FV, SL","created":"22-Oct-2018","title":"# TIP 523: New lpop command","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-523","votes-present":"none","is-jest":false},

>
>







1
2
3
4
5
6
7
8
9
10
{"tip": {
	"531":{"url":"./tip/531.md","":"","keywords":"Tcl, stubs","created":"14-Dec-2018","post-history":"","state":"Draft","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 531: Static Tcl Interpreter Creation Function","/usr/local/include/tcl8.6/tcldecls.h":"#define Tcl_CreateInterp \\","author":["Shannon Noe <[email protected]>"],"is-jest":false},
	"530":{"url":"./tip/530.md","tcl-ticket":"a09031e288","created":"13-Dec-2018","post-history":"","state":"Draft","tcl-version":"8.6, 8.7","vote":"Pending","type":"Project","title":"# TIP 530: Control over performance impact of TIP 280","author":["Leon Manukyan <[email protected]>"],"is-jest":false},
	"529":{"url":"./tip/529.md","keywords":"Tk, image","created":"07-Dec-2018","state":"Draft","tk-branch":"tip-529-image-metadata","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 529: Add metadata dict property to tk photo image","author":["Harald Oehlmann <[email protected]>"],"is-jest":false},
	"528":{"url":"./tip/528.md","created":"05-Dec-2018","post-history":"","state":"Draft","tk-branch":"offsetof","tcl-version":"8.7","vote":"Pending","type":"Project","title":"# TIP 528: Deprecate Tk_Offset()","author":["Jan Nijtmans <[email protected]>"],"is-jest":false},
	"527":{"url":"./tip/527.md","created":"26-Nov-2018","post-history":"","state":"Draft","tcl-branch":"sebres-8-6-timerate","tcl-version":"8.5","vote":"Pending","type":"Project","title":"# TIP 527: New measurement facilities in TCL: New command timerate.","discussions-to":"news:comp.lang.tcl","author":["Sergey G. Brester <[email protected]>"],"is-jest":false},
	"526":{"url":"./tip/526.md","created":"08-Nov-2018","post-history":"","state":"Draft","tcl-version":"9.0","vote":"Pending","type":"Project","title":"# TIP 526: Make [expr] Only Accept One Argument","author":["Donal K. Fellows <[email protected]>"],"is-jest":false},
	"525":{"url":"./tip/525.md","keywords":"Tcl, testing, continuous integration","state":"Final","type":"Project","author":["Donal K. Fellows <[email protected]>"],"vote-results":"8/0/0 accepted","votes-for":"KBK, SL, AF, DGP, FV, DKF, AK, JN","votes-against":"none","created":"24-Oct-2018","title":"# TIP 525: Make Tcltest Report Overall Success in a Machine-Readable Way","post-history":"","vote":"Done","tcl-version":"8.5","votes-present":"none","is-jest":false},
	"524":{"url":"./tip/524.md","keywords":"Tcl, object orientation, customization","state":"Final","vote-summary":"Accepted 2/0/4","type":"Project","author":["Donal K. Fellows <[email protected]>"],"votes-against":"none","votes-for":"DKF, JN","created":"23-Oct-2018","title":"# TIP 524: Custom Definition Dialects for TclOO","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-524","votes-present":"BG, KBK, FV, SL","is-jest":false},
	"523":{"url":"./tip/523.md","keywords":"queue, stack, pop","state":"Final","vote-summary":"Accepted 7/0/0","type":"Project","author":["Peter Spjuth <[email protected]>"],"votes-against":"none","votes-for":"DKF, BG, KBK, JN, DGP, FV, SL","created":"22-Oct-2018","title":"# TIP 523: New lpop command","post-history":"","vote":"Done","tcl-version":"8.7","tcl-branch":"tip-523","votes-present":"none","is-jest":false},
526
527
528
529
530
531
532
533
534
	"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","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","post-history":"","state":"Active","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": 529
}, "@timestamp": 1544524939}







|
|
528
529
530
531
532
533
534
535
536
	"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","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","post-history":"","state":"Active","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": 531
}, "@timestamp": 1546362270}
Changes to index.md.
117
118
119
120
121
122
123








124
125
126
127
128
129
130
131
132
133
134
135
136
<th>Tcl Version</th>
<th>Status</th>
<th>Title</th>
<th>Impl.</th>
</tr></thead><tbody>

<tr class='project projectdraft projectdraft87 project87'>








<td valign='top'><a href='./tip/530.md'>530</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.6, 8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 530: Control over performance impact of TIP 280</td>
<td valign='top'></td>
</tr>
<tr class='project projectdraft projectdraft87 project87'>
<td valign='top'><a href='./tip/529.md'>529</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 529: Add metadata dict property to tk photo image</td>







>
>
>
>
>
>
>
>





|







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<th>Tcl Version</th>
<th>Status</th>
<th>Title</th>
<th>Impl.</th>
</tr></thead><tbody>

<tr class='project projectdraft projectdraft87 project87'>
<td valign='top'><a href='./tip/531.md'>531</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 531: Static Tcl Interpreter Creation Function</td>
<td></td>
</tr>
<tr class='project projectdraft projectdraft86 project86'>
<td valign='top'><a href='./tip/530.md'>530</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.6, 8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 530: Control over performance impact of TIP 280</td>
<td valign='top'><a href='/tcl/tktview/a09031e288'>Link</a></td>
</tr>
<tr class='project projectdraft projectdraft87 project87'>
<td valign='top'><a href='./tip/529.md'>529</a></td>
<td valign='top'>Project</td>
<td valign='top'>8.7</td>
<td valign='top'>Draft</td>
<td valign='top'># TIP 529: Add metadata dict property to tk photo image</td>
Added tip/531.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
# TIP 531: Static Tcl Interpreter Creation Function
	Author:         Shannon Noe <[email protected]>
	State:          Draft
	Type:           Project
	Vote:           Pending
	Created:        14-Dec-2018
	Post-History:  
	Keywords:       Tcl, stubs
	Tcl-Version:    8.7
----

# Abstract

This TIP adds a helper function to the tclstubs library for creating an interpreter.
The `Tcl_CreateInterp` function is dependent on the order defining `USE_TCL_STUBS` and inclusion of `tcl.h`.
When users get this wrong the error is a null pointer exception (NPE) on the stubs table.
For some TCLers/C users this takes a bit of digging to unravel the cause of the NPE.

Therefore, I propose a new function `Tcl_CreateInterpWithStubs` which is always fully independent of `USE_TCL_STUBS`. 
This function will be part of the libtclstub87.a library.

# Rationale

Users that are creating interpreters are often getting errors because they are getting the `Tcl_CreateInterp` macro.
This error is a runtime null pointer exception which several users find confusing.
The user as to be astute enough to follow instructions and see that `USE_TCL_STUBS` will replace a C function call with a macro.
By providing a plain function, the users can have a easier time embedded interperters and using stubs.

```
/usr/local/include/tcl8.6/tclDecls.h:#define Tcl_CreateInterp \
/usr/local/include/tcl8.6/tclDecls.h- (tclStubsPtr->tcl_CreateInterp) /* 94 */
```

# Specification

There will be a new function in `libtclstub??.a` that always performs interpreter initialization and stub table initialization.
The signature is **Tcl\_CreateInterpWithStubs**(const char \*_version_, int _exact_).
The _version_ and _exact_ parameters match `Tcl_InitStubs`.

On error NULL is returned instead of a TCL interpreter.
Without this pointer there is no way to obtain extended error codes, but the trade off is that it makes the API much easier to use.
(That could be an error, someone could clarify that for me.)

## Example Implementation

``` 
/* must be compiled without stubs */

#undef USE_TCL_STUBS
#include <tcl.h>

Tcl_Interp *
Tcl_CreateInterpWithStubs(
    const char *version,
	int exact)
{
    Tcl_Interp *interp = Tcl_CreateInterp();

    if (Tcl_Init(interp) == TCL_ERROR ||
            Tcl_InitStubs(interp, version, exact) == NULL ||
            Tcl_PkgRequire(interp, "Tcl", version, exact) == NULL) {
        return NULL;
    }

    return interp;
}
```

# Implementation

Please refer to the `tip-???` branch of the core Tcl repository.

# Backwards Compatibility

This is a new function in the TCL C API.

# Copyright

This document has been placed in the public domain.