TIP 696: Reserve range of return codes for Tcl's own use

Author:		Ashok P. Nadkarni <[email protected]>
State:		Draft
Type:		Project
Vote:		Pending
Created:	2024-05-14
Tcl-Version:	9.0


This TIP proposes reservation of a range of Tcl return codes for Tcl's own use so as to avoid conflicts with return codes used by extensions and applications.


Tcl return codes are 32-bit integers with values 0-4 defined as ok, error, return, break, continue. Extensions are free to use other values as they see fit. This has two repercussions:

The author has had similar considerations experimenting with alternative tailcall implementations as well as a coroutine based actor extension.


The range of return code values between TCL_CODE_MIN and TCL_CODE_MAX will be reserved for Tcl's own use. Positive values above TCL_CODE_MAX and negative values below TCL_CODE_MIN are available for use by applications and extensions.

The following public #defines will be added to tcl.h

#define TCL_CODE_MAX 0x40000000  /* 1073741824 */



To be done but is trivial.


This document has been placed in the public domain.