Posted to tcl by aspect at Fri May 08 23:10:46 GMT 2015view raw
- oo::class create Juggler {
- method juggle {name target {value ""}} {
- if {$value eq ""} {
- set value [yield [info coroutine]]
- }
- while {$value ne ""} {
- puts "$name : $value"
- set value [string range $value 0 end-1]
- lassign [yieldto $target $value] value
- }
- }
- }
- Juggler create juggler
- coroutine j1 juggler juggle Larry [
- coroutine j2 juggler juggle Curly [
- coroutine j3 juggler juggle Moe j1]] "Nyuck!Nyuck!Nyuck!"