Reflecting channels back into Tcl ================================= Rev 1.0: Renamed (used to be called rchan), fixed fileevent timer bugs Rev 0.10: Initial release The http://mini.net/tcl/2514.html page is a good spot to comment on this. This package defines a "rechan" command, which lets you create Tcl-style channels that are completely handled by Tcl scripts, instead of C code. Rechan must be called with two arguments to create a new channel: rechan cmd mode Where: cmd = the name of the "callback" that will process requests mode = the open mode (6 is R/W, the normal case) The callback cmd can be one or more words (i.e. a list). Depending on the operation, a request name and some args will be tacked on before invoking it. The following requests are implemented: $cmd seek $chan ?? called when a "seek $chan ??" is done $cmd read $chan called when a "read $chan " request is made $cmd write $chan called when a "write $chan " request is made $cmd close $chan called when the channel is closed Other operations are not supported. Rechan is not all that capable, though it works with fileevents now. It has been invaluable in TclKit to implement its database-backed VFS design. Without some sort of "reflection", the Virtual File System (whether the original one by Matt Newman or the C-based on in the core by Vince Darley) could not have been implemented. It is hoped that one day, some sort of channel reflection becomes part of standard Tcl, and included in the core.