From: mark anthony on 21 Feb 2010 19:50 On Jan 15, 4:54 am, shags72 <je...(a)mtco.com> wrote: > On Jan 14, 5:12 am, mark anthony <koyam...(a)gmail.com> wrote: > > > > > > > On Jan 13, 3:37 pm, shags72 <je...(a)mtco.com> wrote: > > > > > However, it is not needed as lappend (and append) are documented and defined > > > > to create the variable if it does not exists. Thus you could just do: > > > Yes I should be checking listvar, my typing mistake. > > > Avoid info commands if you do not need them, esp if you loop. They are > > damn expensive. > > > If you know it fails you only once or not that often, constructs like: > > > if {[::catch { > > something_that_might_fail}]} then { > > > it_failed_so_init_it > > > } > > > are better. > > > In your example you use globals. > > > So instead of info exists checks all over the place, initialize them. > > > cleaner and cheaper. > > > koyama > > What does the :: do for you in front of the catch? I have seen it used > for establishing what I consider global but have > something to do with namespace. sorry for the late reply just in case ppl stumble upon this, here is my answer. yes, you are right. its namespaces. i am used to put it in front because i tend to like to use names, that buildin commands have, in my namespaces. so for the sake of less headache i use :: everywhere when i refer to the real thing (as you said its the global command for that name). things like ::car::open $door ::db::set $key $value ::queue::append $guy just look better to the eye, imho. usually i don't use it here on the newsgroup but sometimes it turns up in my snippets and is doing confusion. sorry about that. koyama
|
Pages: 1 Prev: Tk : trying to manage a labelframe Next: adding jpeg to mp3 file |