tcl::chan::core(n)
π tcl::chan::core(n) β Basic reflected/virtual channel support π
okay bestie, so this is the manual for tcl::chan::core, living in the Reflected/virtual channel support corner of the tcllib universe. sit down, grab a boba, we're doing channel guts today π§β¨
β¨ NAME β¨
tcl::chan::core β basic reflected/virtual channel support. yes. that's the whole vibe. it's the foundation bestie, the base layer, the primer before the makeup π
πΈ SYNOPSIS πΈ
package require Tcl 8.5 9
package require TclOO
package require tcl::chan::core ?1.1?
::tcl::chan::core objectName
objectName initialize thechannel mode
objectName finalize thechannel
objectName destroy
π¦ DESCRIPTION π¦
so the tcl::chan::core package hands you a TclOO class that implements all the common behaviour that virtually every reflected or virtual channel needs β we're talking initialization and finalization, the little rituals, the getting-ready-and-going-home of channel life π
and the way this class expects to be used? either as the superclass of a concrete channel class, or mixed into one. no cap, those are the two options. pick your fighter π
π CLASS API π
::tcl::chan::core objectNameβ this makes a brand-new channel core object, and it comes with a global Tcl command attached whose name is objectName. you can use that command to poke at the object in all the ways listed down in the INSTANCE API section. it's giving "your new bestie has a name, use it" π«Ά
β INSTANCE API β
okay so the API of channel core instances is tiny β literally just two methods β and both of them line up with channel handler commands (for the receipts, see TIP 219 at http:/tip.tcl.tk/219). and important: they expect to be called from whatever object instance the channel core got made a part of. iykyk π
objectName initialize thechannel modeβ this method does the standard behaviour for theinitializemethod of channel handlers. using introspection it sniffs out the handler methods that the instance supports, and returns a list with their names β exactly the shape the Tcl core's reflected-channel support is expecting π₯
and plot twist: it also stashes the channel handle in an instance variable so sub-classes can reach it later. thoughtful queen behavior fr fr π
objectName finalize thechannelβ this one does the standard behaviour for thefinalizemethod of channel handlers. and what does it do? it simply destroys itself. dramatic exit, no notes, periodt πobjectName destroyβ destroying the channel core instance closes the channel it was initialized for (see theinitializemethod above, bestie, keep up π ). BUT β and this is the β¨important caveatβ¨ β when it's destroyed from inside a call offinalize, that closing does not happen, because we're assuming Tcl itself is the one destroying the channel. so like, don't double-destroy, that's not the move π
π BUGS, IDEAS, FEEDBACK π
ngl, this document β and the package it describes β will undoubtedly contain bugs and other problems. it's giving "we know, we know." π
please report them in the category virtchannel of the Tcllib Trackers: http://core.tcl.tk/tcllib/reportlist
and please also send in any ideas for enhancements you have for either the package and/or the documentation. we want them, fr fr π«Ά
if you're proposing code changes, please provide unified diffs β that's the output of diff -u, bestie, we need the format π
also noting: attachments are strongly preferred over inlined patches. to attach something, go to the Edit form of the ticket right after you create it, then use the left-most button in the secondary navigation bar. there it is. that's the button. go get it π
π KEYWORDS π
reflected channel, tip 219, virtual channel
πΈ CATEGORY πΈ
Channels
π COPYRIGHT π
Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
and that's the whole page bestie!! this one shipped as part of tcllib, version 1.1 β so if you ever need to cite it, that's the source and the version right there. now go forth and build your reflected channels, you absolute icon πβ¨π
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2009 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms