Author: Jan Nijtmans <[email protected]>
State: Final
Type: Project
Vote: Done
Created: 24-05-2022
Tcl-Version: 9.1
Keywords: Tcl
Tcl-Branch: tip-626
Vote-Summary: Accepted 4/0/1
Votes-For: AK, HO, JN, SL
Votes-Against: none
Votes-Present: AN
Abstract
This TIP proposes to change Tcl internally, to use Tcl_CreateObjCommand2() and
friends (TIP #627 and #630), and to change all internal handling, allowing
> 2^31 command line elements. This doesn't change any API (since the API is
already available), but it has some consequences.
Rationale
The new functions in TIP #627 and #630 allow any list to be converted to a
command, without worrying about the length of the list. It completes the conversion
of Tcl and Tk, using Tcl_Size internally in stead of int, everywhere.
Example:
% set s [string cat {*}[lrepeat 0x100000000 x]]; string length $s
4294967296
This doesn't mean that all commands using such large arguments actually run: they might panic because they use more memory than available in the system. TIP #721 is meant to remedy this, by turning the panic into a run-time error, but that's out-of-scope for this TIP.
Specification
Starting with Tcl/Tk 9.1, the following 8 functions (and 3 for Itcl) are capable of using either Tcl_Size type arguments or int type arguments, if your compiler is c11-capable:
Tcl_CreateObjCommandTcl_CreateTraceTcl_CreateObjTraceTcl_NRCallObjProcTcl_NRCreateCommandTcl_MethodIsTypeTcl_NewInstanceMethodTcl_NewMethodItcl_RegisterC(Itcl)Itcl_RegisterObjC(Itcl)Itcl_FindC(Itcl)
If your compiler is not c11-capable, the *2 versions of TIP #627
and #630 functions can be used directly, enabling the increased
number of arguments. With c11-compatibility, you can simply leave
out the 2 in the function name.
It also means that - due to the internal changes - some extensions
which depend on the internal behavior won't work any more as-is.
Especially nsf will need to be modified.
For extensions which only depend on the public API, everything works as before.
Implementation
See branch tip-626
The idea (and implementation) of using the c11-capability, is stolen from
the c11-generic-oo-api branch (thanks, @dkf!).
The Itcl part of this TIP is not implemented yet, but that will follow soon after this TIP is accepted.
Copyright
This document has been placed in the public domain.
