Posted to tcl by dgp at Thu Jun 13 15:02:31 GMT 2019view raw
- $ cat evtest.tcl
- namespace eval provide {
- proc irk args {puts BROKEN!}
- proc every {ms script} {
- puts $script
- try $script
- set callerNs [uplevel 1 {::namespace current}]
- after $ms [list after idle [list namespace inscope $callerNs [info level 0]]]
- }
- namespace export every
- }
- namespace eval consume {
- namespace import ::provide::every
- rename every irk
- irk 1000 {puts TICK}
- }
- vwait forever
- $ tclsh evtest.tcl
- puts TICK
- TICK
- puts TICK
- TICK
- puts TICK
- TICK
- ...