Re: New question on strings
- From: "tom.rmadilo" <tom.rmadilo@xxxxxxxxx>
- Date: Thu, 28 Feb 2008 11:04:16 -0800 (PST)
On Feb 28, 9:58 am, "tom.rmadilo" <tom.rmad...@xxxxxxxxx> wrote:
On Feb 28, 7:44 am, Neil Madden <n...@xxxxxxxxxxxxx> wrote:
tom.rmadilo wrote:
OMG, is this another one of those regressions? I guess so. [Incr] now
auto initializes to zero if the variable doesn't exist.
See TIP 215
BTW, initialization is a complex subject. With the changes that auto-
initialize lists and strings, [lappend], [append], maybe others, you
get an small benefit during an initial setup, but if you use a
variable in a loop, you instantly run into the problem of re-
initialization. Considering the fact that [incr] essentially implies a
loop of some type, that is some code is being executed multiple times,
the tiny benefit of auto-initialization seems more like a C-like
syntax optimization that just makes code harder to read, maintain and
debug.
Another ambiguity is if a variable is supposed to exist prior to an
[incr] statement:
namespace eval ::num {
variable i
}
proc ::num::get { } {
return [incr i]
}
Code looks perfect, but they probably meant:
proc ::num::get {} {
variable i
return [incr i]
}
These are not typos, these are examples where things work, and the
original intent is not obvious. If someone were to look at the code,
with the bug, and tried to write up a regression test, is their job
made easier?
.
- Follow-Ups:
- Re: New question on strings
- From: Andreas Leitgeb
- Re: New question on strings
- References:
- New question on strings
- From: mark
- Re: New question on strings
- From: mark
- Re: New question on strings
- From: Gerald W. Lester
- Re: New question on strings
- From: tom.rmadilo
- Re: New question on strings
- From: Neil Madden
- Re: New question on strings
- From: tom.rmadilo
- New question on strings
- Prev by Date: Re: serial communication with tcl
- Next by Date: Strange font/language issue on Solaris 10 and wish8.3
- Previous by thread: Re: New question on strings
- Next by thread: Re: New question on strings
- Index(es):
Relevant Pages
|