tcl::c...ariable(3tcl)
π tcl::chan::variable β the 3tcl manual, but make it make sense π
okay bestie, so this is the page for tcl::chan::variable, and it lives in the 3tcl manual section (that's the Tcl library section, iykyk). It's part of tcllib and it's giving channels but make them live in your RAM. Let's get into it. β¨
πΈ NAME πΈ
tcl::chan::variable β an in-memory channel that uses a variable as its storage. yes, literally, the variable is the channel. iconic behaviour.
π 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
so first you need Tcl 8.5 or 9, plus TclOO (the object system, obviously), plus tcl::chan::events β version 1.1 if you wanna pin it β and then tcl::chan::variable itself, version 1.0.5 if you're feeling specific. then you call it with a varname. periodt. π«Ά
β¨ DESCRIPTION β¨
The tcl::chan::variable package gives you a command that makes channels, and those channels live purely in memory. no disk, no files, no drama. π
They're random-access, which is the fancy way of saying they're seekable β you can jump around in them, you're not stuck reading front-to-back like some kind of cassette tape. main character energy.
BUT. here's the plot twist that makes this package special: unlike the channels you get from tcl::chan::memchan, the data is not hidden inside the channel. nope. it's stored in an associated variable, and you specify that variable when you construct the thing. so you can just... look at your data. whenever. in a variable. obsessed. ππ
Packages that are related to this one are tcl::chan::memchan and tcl::chan::string β go read those too, bestie.
The internal TclOO class that implements the channel handler is a sub-class of the tcl::chan::events framework. so yeah, it's plugged into the event system. no cap. π§
π₯ 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 variable varname.
that's the whole API. one command. one argument. she's efficient. π
π BUGS, IDEAS, FEEDBACK π
okay so real talk, this document and the package it describes will undoubtedly contain bugs and other problems. they said it, not me. π please report them in the category virtchannel of the Tcllib Trackers at:
http://core.tcl.tk/tcllib/reportlist
and please ALSO report any ideas you have for enhancements β for either the package and/or the documentation. we want the ideas, bestie, give them to us. π«Ά
When you're proposing code changes, please provide unified diffs, i.e. the output of:
diff -u
Also, note further that attachments are strongly preferred over inlined patches. to attach something, go to the Edit form of the ticket right after you create it, and then use the left-most button in the secondary navigation bar. that's the one. left-most. you got this. π
β 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, babe π this was tcllib version 1.0.5, manual page tcl::chan::variable(3tcl) β go forth and make some in-memory channels, you're gonna slay πβ¨π¦
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- 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