incr-tcl

How to get a reference on the Itcl class member variable?

浪尽此生 提交于 2020-02-07 03:16:06
问题 Say I have the following structure: package require Itcl itcl::class AAA { private variable m_list {} constructor {} { fill m_list list } } How to get a reference on the m_list in order to write foreach elem $reference {.......} Consider that list is really big and I don't want to copy it! 回答1: Tcl variables use copy-on-write semantics. You can safely pass a value around, assigning multiple variables to it, without worrying about it taking up more space in memory. For example set x {some list