transchan

https://www.tcl-lang.org/man/tcl8.6/TclCmd/transchan.htm

This is a protocol for defining a channel transform, which is a way to intercept the reading and writing of bytes on a channel with a Tcl script and modify them (e.g., handling encryption, logging or compression). The script is attached via chan push.


The script is defined by a command prefix (which could be the name of an ensemble command, an object, or even a multi-word lambda term). We'll treat it as an object here.

When attached, the initialize method is called to get the list of supported methods (by name). For a reader transform, the relevant methods are read (mandatory for readers), drain and limit?. For a writer transform, the relevant methods are write (mandatory) and flush. Both types must also support finalize (for when the channel is closed or the transform detached with chan pop) and may support clear too.

[replace with details of this command]

[DKF: It's not a command; it's a protocol that a command prefix should adhere to to participate as a channel transform.]