| tom.rmadilo 2008-01-30, 7:46 pm |
| On Jan 30, 1:19 pm, Mark Janssen <mpc.jans...@gmail.com> wrote:
> On Jan 30, 10:09 pm, "tom.rmadilo" <tom.rmad...@gmail.com> wrote:
>
> All Tcl commands are the same.
That statement is about as useful as me point out how useless it is.
> can't read a is because you break out of the loop before a is set.
Well, my thesis here is that [break] and [continue] (and [foreach])
are not the same as most other commands because they don't return
meaningful values. In fact, [break] and [continue] don't return a
value at all, and by 'return a value', what I mean is that they change
or set a Tcl result.
If everything goes okay for each of these commands (and other similar
commands), the result is reset to an uninitialized state. The
uninitialized state just happens to be the same as an empty string.
Does that mean these commands return a value? No. Values have meaning.
If these commands could return a meaningful empty string, then the
fact that they could return a meaningless empty string would introduce
serious problems. You could not rely on the return value to indicate
anything, and that is exactly why nobody even asks this type of
question.
So all Tcl commands are not the same. Some return a meaningless empty
string. This is very different from a real empty string.
In addition, [break] and [continue] don't set or return a result. They
will trigger an error if used outside of a loop, but this is very
different from most Tcl commands. The options are 1. either [break] or
[continue] are correctly called within a loop and there is an internal
break/continue, or 2. they are somehow called outside a loop and some
other code sets an error message. In no case do these commands return
to the Tcl script level.
|