tcl::chan::variable(n)
π tcl::chan::variable(n) β bestie edition π
okay so this is a page from the tcllib docs, living under the Reflected/virtual channel support umbrella. yes it's a manual page, yes it's n section, and yes we're gonna make it cute. pull up a chair π«Ά
β¨ NAME β¨
tcl::chan::variable β an in-memory channel that uses a variable for storage. that's the whole vibe. channel but the data lives in a variable. slay.
πΈ SYNOPSIS πΈ
package require Tcl 8.5 9
package require TclOO
package require tcl::chan::events ?1.1?
package require tcl::chan::variable ?1.0.5?
::tcl::chan::variable varname
the ?1.1? and ?1.0.5? are minimum-version hints btw β that's just how these package require lines roll. not me being mysterious on purpose π
π¦ DESCRIPTION π¦
so the tcl::chan::variable package gives you a command that makes channels which live purely in memory. they're random-access, which is the fancy way of saying they're seekable β you can jump around in them like it's nothing. main character energy fr.
here's the lil twist though, and it's the whole point of this package: unlike the channels you get from tcl::chan::memchan, the data is not hidden inside the channel. instead it's stored in an associated variable, and you name that variable at construction time. so you can literally just... look at your data. it's right there. iconic.
related packages if you wanna go down the rabbit hole: tcl::chan::memchan and tcl::chan::string. β¨
also, for the people who care about internals (iykyk): the internal TclOO class that implements the channel handler is a sub-class of the tcl::chan::events framework. so it's events-flavored underneath. π
π API π
::tcl::chan::variable varnameβ this command creates a brand new variable channel and hands you back its handle. the content of the channel is stored in the associated namespace variablevarname. that's it. that's the whole API. one command, maximum slay. π
π BUGS, IDEAS, FEEDBACK π
ngl, this document and the package it describes will undoubtedly contain bugs and other problems. that's just how software is, bestie. so please report them in the category virtchannel of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. also β if you have ideas for enhancements for either the package and/or the documentation, send those too. we want them. π«Ά
when you're proposing code changes, please provide unified diffs, i.e. the output of diff -u. no freestyle diffs please.
also note: attachments are strongly preferred over inlined patches. to attach something, go to the Edit form of the ticket immediately after its creation, and then use the left-most button in the secondary navigation bar. that's the secret handshake. π§
β KEYWORDS β
in-memory channel, 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!! π this one shipped as part of tcllib, version 1.0.5, and it's the tcl::chan::variable(n) page β so if you cite it, cite it right. periodt. π
β¨
π¦ 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