Posted to tcl by mjanssen at Tue Feb 10 00:10:48 GMT 2009view pretty

# missing items
# 1) ability to yield an error (possibly with -level to create nice error messages in the same manner as return)
# 2) ability to call the coro with arbitrary # args (yield will always return a list)
# 3) maybe, abillity to do info level (not sure if this is really doable/useful


proc _object {args} {
  set next [lindex $args 0]
  while {$next ne "destroy"} {
   # actual dispatch loop will be here
   switch [lindex $next 0] {
     parents* {
	set res ""
     }
     clone {
	set res $a
     }
    "" {
	set a 4
        set res ok
    }
   }
   set next [yield $res]
  }
}

coroutine Object _object

Object parents*
Object clone
Object destroy
Object sadas