TIP 581: Master/Slave

Login
Author:         Jan Nijtmans <[email protected]>
State:          Final
Type:           Project
Vote:           Done
Created:        17-July-2020
Post-History:
Tcl-Version:    8.6
Keywords:       Tcl
Tcl-Branch:     tip-581
Vote-Summary:   Accepted 9/0/0
Votes-For:      BG, DKF, FV, JD, JN, KBK, KW, MC, SL
Votes-Against:  none
Votes-Present:  none

Abstract

This TIP proposes to purge the usage of the Master/Slave paradigm from Tcl and Tk. This is a gradual process to be completed in Tcl/Tk 8.7.

Rationale

A discussion is currently going on about the Master/Slave and Blacklist/Whitelist paradigm: Linux, Github and a lot more decided not to use this terms any more. The TCT as a whole has no opinion on this (although individual member will - sure - have an opinion). Since Tcl is a language for everyone, we should not make life difficult for people being enforced to comply with whatever rules. Since there is very little impact on Tcl, let's bend a little bit.

For Tk we cannot simply replace the Master/Slave paradigm to Parent/Child. Sometimes it's better to replace Master to Main (e.g. when menu's are involved). In the case of Tk's geometry handles (pack/place/grid), we will use the container/content concept. For Images, Model is a better name for Master.

See: Terminology, Power, and Inclusive Language in Internet-Drafts and RFCs

Specification (Tcl part)

In tclDecls.h, the following #define's are added:

#define Tcl_CreateChild Tcl_CreateSlave
#define Tcl_GetChild Tcl_GetSlave
#define Tcl_GetParent Tcl_GetMaster
In tclIntDecls.h, the following #define is added:
#define TclSetChildCancelFlags TclSetSlaveCancelFlags

Further on, the "interp" command will get an additional subcommand "children", which is synonym for "slaves".

That's it! This will allow extension/application writers to comply with external limitations when they want to or are forced to do so.

The "interp slaves" subcommand will not be deprecated, not even in Tcl 9.0. Neither will the usage of Tcl_CreateSlave and friends be deprecated: Extension/application writers are not forced to make the change, but they will be able to.

In Tcl 8.7, the documentation and header files will be changed to comply with this renaming. The above #define's will be reversed, so the functions will continue to be available under the old name too.

Specification (Tk part)

In tk.h, the following #define is added:

#define Tk_ImageModel Tk_ImageMaster
In tkDecls.h, the following #define is added:
#define Tk_GetImageModelData Tk_GetImageMasterData
In tkInt.h, the following #define is added:
#define TkGetContainer TkGetGeomMaster
In tkIntPlatDecls.h, the following #define is added:
#define TkMacOSXGetContainer TkGetTransientMaster

Further on, the "pack"/"place"/"grid" commands will get an additional subcommand "content", which is synonym for "slaves".

The original "pack/place/grid slaves" subcommands will not be deprecated.

In Tcl 8.7, the documentation and header files will be changed to comply with this renaming. The above #define's will be reversed, so the functions will continue to be available under the old name too.

Compatibility

This is 100% upwards compatible.

Addendum

After the vote completed, a discussion started whether TkGetGeomContainer/TkGetTransientContainer really were good names describing the functions well. The outcome of this was the decision to rename those finally to TkGetContainer/TkMacOSXGetContainer, therefore the text above was adapted accordingly. Since Tcl doesn't guarantee keeping internal API the same in minor releases, this might be changed further in Tcl 8.7, but in any future Tcl 8.6 release it will not change any more.

\#define TkGetGeomContainer TkGetGeomMaster
\#define TkGetTransientContainer TkGetTransientMaster

Implementation

See the tip-581 (Tcl) branch. and the tip-581 (Tk) branch.

Copyright

This document has been placed in the public domain.