Artifact 41e86c26b733a3d8e73168a70a433e02b1fe9933:
namespace eval foo {
namespace ensemble create -subcommands {initialize finalize watch write}
}
proc foo::initialize {id mode} {
return [namespace ensemble configure foo -subcommands]
}
proc foo::watch {id spec} {
if {"write" in $spec} {
chan postevent $id write
}
}
proc contact {fd} {
chan event $fd writable {}
}
set fd [chan create write foo]
chan event $fd writable [list contact $fd]