Updated 2017-06-09 13:29:44 by dbohdan

word.tcl is an implementation of word channels found in ycl.


You can download word.tcl for use outside of ycl (under the namespace ::wordchan rather than [yclprefix]::chan::word) with the following POSIX shell command:

(echo -e "namespace eval ::wordchan {\nnamespace export *\nnamespace ensemble create\n"; curl -s 'https://chiselapp.com/user/pooryorick/repository/ycl/raw/packages/chan/lib/word.tcl?name=024541bdf04b7a9e637add29ac2cd75df2543e74'; echo -e "\n}") > wordchan.tcl

Use example

#!/usr/bin/env tclsh
source wordchan.tcl

proc main {} {
    set ch [chan create {read write} ::wordchan]
    chan configure $ch -buffering none
    puts -nonewline $ch HELLO
    puts -nonewline $ch WORLD
    puts [read $ch] ;# Prints "HELLO".
    puts [read $ch] ;# Prints "WORLD".