yyamasak
3/7/2016 - 11:24 AM

Tcl 8.6's coroutine doesn't work with XOTcl

Tcl 8.6's coroutine doesn't work with XOTcl

package require XOTcl
namespace import xotcl::*

proc log {msg} {
	set ts [clock format [clock seconds] -format %T]
	puts "\[$ts\] $msg"
}

Class Test

Test instproc log {msg} {
	::log "[self] $msg"
}

Test instproc start {} {
	my instvar co
	set co [self]_co_sequence
	coroutine $co [myproc sequence]
	$co
}

Test instproc sequence {} {
	my log "start"
	after 2000 [info coroutine]
	yield
	my log "end"
}

set test [Test new]
$test start