Tcl Source Code

Artifact [d2759d27fb]
Login

Artifact d2759d27fb99f80aabfd6a8c8fda4b04c104b2a4:

Attachment "tailcall.tcl" to ticket [3483088fff] added by coldstore 2012-02-02 14:13:57.
oo::class create Fred {
    method test1 {} {
	puts stderr test1
    }

    method test2 {args} {
	puts stderr test2
    }

    method test3 {} {
	puts stderr test2
    }

    method test4 {} {
	tailcall coroutine X4 apply {{} {puts stderr moop; ::yield}}
    }

    method test5 {} {
	tailcall coroutine X5 apply {{} {puts stderr moop; ::yield}}
    }
}

oo::class create Pebbles {
    method test1 {} {
	next
    }

    method test2 {} {
	tailcall next moop
    }

    method test3 {} {
	tailcall next
    }

    method test4 {} {
	next
    }

    method test5 {} {
	tailcall next
    }

    superclass Fred
}

Pebbles create pebbles
pebbles test1
pebbles test4
pebbles test5
pebbles test3
pebbles test2