Re: Why doesn't foreach return a value
- From: "tom.rmadilo" <tom.rmadilo@xxxxxxxxx>
- Date: Sat, 2 Feb 2008 19:47:13 -0800 (PST)
On Feb 1, 5:56 pm, Darren New <d...@xxxxxxxxxx> wrote:
tom.rmadilo wrote:
Maybe it is more accurate to
say that Tcl evaluation does not return to the script if an
exceptional condition is returned by any command found in that script.
No, it isn't.
The script is destroyed, evaluation stops and control is returned to
the enclosing context.
No, it isn't.
I guess what you guys should do is submit a massive request to update
the Tcl documentation, because the distinctions I have made appear to
be present in every case:
Some commands return a meaningful value:
gets, if, regexp, etc.
Some commands return a meaningless value:
foreach, while, for
Some commands don't return a value (they don't return to (but abort)
the script where they were invoked, and maybe cause higher up scripts
to abort as well, all without returning):
break, continue, return, error
Also, the documentation is as confused as I am about return codes,
saying that they are used to control flow, and have nothing to do with
the return value.
But I'm sorry to report that the commands which don't return a value,
according to the documentation, all use a similar phrase 'returns a
code ... which causes' something to happen.
The documentation is also annoyingly consistent about what script is
aborted and where control is directed to continue.
Very sad, I hope you guys can fix all those documentation errors.
That, and all the code comments, must have been what confused me.
Also, those bytecode substitutions, like totally skip over code when
replacing break and continue. Probably the bytecode stuff is wrong,
you can't just skip over all that important returning stuff.
I can't wait to start using the return values of all of these
commands, just as soon as you document how to get them. Then I can
join the confederacy of dunces.
.
- Follow-Ups:
- Re: Why doesn't foreach return a value
- From: Arnulf Wiedemann
- Re: Why doesn't foreach return a value
- From: Fredderic
- Re: Why doesn't foreach return a value
- From: Darren New
- Re: Why doesn't foreach return a value
- References:
- Re: Why doesn't foreach return a value
- From: Fredderic
- Re: Why doesn't foreach return a value
- From: tom.rmadilo
- Re: Why doesn't foreach return a value
- From: Darren New
- Re: Why doesn't foreach return a value
- Prev by Date: Re: Obstacles for Tcl/Tk commercial application development ?
- Next by Date: Re: BWidget "ListBox see"
- Previous by thread: Re: Why doesn't foreach return a value
- Next by thread: Re: Why doesn't foreach return a value
- Index(es):
Relevant Pages
|
|