TIP 626: Command arguments > 2^31 elements

Login
Bounty program for improvements to Tcl and certain Tcl packages.
    Author:        Jan Nijtmans <jan.nijtmans@gmail.com>
    State:         Draft
    Type:          Project
    Vote:          Pending
    Created:       24-05-2022
    Tcl-Version:   9.1
    Keywords:      Tcl
    Tcl-Branch:    tip-626

Abstract

This TIP proposes to change Tcl internally, to use Tcl_CreateObjCommand2() and friends (TIP #627), 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 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

Specification

Starting with Tcl/Tk 9.1, the following 8 functions (and 3 for Itcl) are declared deprecated:

  • Tcl_CreateObjCommand
  • Tcl_CreateTrace
  • Tcl_CreateObjTrace
  • Tcl_NRCallObjProc
  • Tcl_NRCreateCommand
  • Tcl_MethodIsType
  • Tcl_NewInstanceMethod
  • Tcl_NewMethod
  • Itcl_RegisterC (Itcl)
  • Itcl_RegisterObjC (Itcl)
  • Itcl_FindC (Itcl)

In favor of (already existing):

  • Tcl_CreateObjCommand2
  • Tcl_CreateObjTrace2
  • Tcl_NRCallObjProc2
  • Tcl_NRCreateCommand2
  • Tcl_MethodIsType2
  • Tcl_NewInstanceMethod2
  • Tcl_NewMethod2
  • Itcl_RegisterObjC2 (Itcl)
  • Itcl_FindC2 (Itcl)

This means that new development should not use those deprecated functions any more, but there is no penalty: No warning will be generated when using any of those functions in extensions. All of those functions still work as before.

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

Copyright

This document has been placed in the public domain.

History