tcl::tr...:observe(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

tcl::transform::observe β€” the observer transformation, aka stream copy, aka "I watch everything and keep receipts" πŸ’…

(oh also hi bestie, this page lives in the Reflected/virtual channel support manual, section n, so if you were looking for it under that name β€” you found her 🫢)


✨ SYNOPSIS ✨

package require Tcl 8.6 9

package require tcl::transform::core ?1.1?

package require tcl::transform::observe ?1.1?

::tcl::transform::observe chan logw logr

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so the tcl::transform::observer package hands you a command that builds a channel transformation. What does it do? It passes the read and written bytes straight through, completely unchanged β€” literally like tcl::transform::identity does, no edits, no drama, the data comes out exactly how it went in. πŸŽ€

But here's the plot twist: on top of that, it also copies the data it has seen, for each direction, into channels you specify when you construct it. So it's the friend who's not changing the group chat, just quietly screenshotting everything into two other chats. 😭

The other transformations hanging out in this module, if you wanna meet the rest of the girlies, are tcl::transform::adler32, tcl::transform::counter, tcl::transform::crc32, and tcl::transform::identity. 🌈

Also, nerd note for the girlies who care (and you should, iykyk): the internal TclOO class doing the actual transform handler work is a subclass of the tcl::transform::core framework. Iconic inheritance moment. πŸ‘‘


πŸ”₯ API πŸ”₯

  • ::tcl::transform::observe chan logw logr β€” makes an observer transformation sitting on top of the channel chan, and returns its handle. The channel handles logr and logw are where the data gets copied to. πŸ‘€

πŸ’€ BUGS, IDEAS, FEEDBACK πŸ’€

Real talk: this document, and the package it describes, will undoubtedly contain bugs and other problems. Not me being shady β€” that's literally what it says. πŸ™ˆ So if you find one, please report it in the category virtchannel of the Tcllib Trackers: http://core.tcl.tk/tcllib/reportlist. And if you have ideas for enhancements for either the package and/or the documentation, send those too, bestie, we want them. πŸ’œ

When you're proposing code changes, please provide unified diffs, i.e. the output of diff -u.

Also, heads up: attachments are strongly preferred over inlined patches. To attach one, go to the Edit form of the ticket right after you create it, then use the left-most button in the secondary navigation bar. 🫢


🌸 KEYWORDS 🌸

channel transformation, observer, reflected channel, stream copy, tip 230, transformation, virtual channel


πŸ‘‘ CATEGORY πŸ‘‘

Channels


Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>


okay that's the whole page, slay πŸ’… this was tcllib, version 1.1, of tcl::tr...:observe(n) β€” go be the main character of your own channel transformation πŸ¦‹βœ¨

πŸ“¦ where this page comes from