Re: examine or describe a proc?
- From: Andreas Leitgeb <avl@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: 30 Oct 2006 12:52:42 GMT
Uwe Klein <uwe_klein_habertwedt@xxxxxxxxxxx> wrote:
Looking at that, I wonder:
set arglist [info args $procname]
while {[llength $arglist] > 0} {
set varg [lvarpop arglist 0]
Can't this be equivalently, but very much simpler, be done as
foreach varg [info args $procname] {
[historical-reasons speculation snipped]
generally it depends:
if [lvarpop] is used more than once in the foreach body,
|| (the loop can be "break"ed out of
&& remaining $arglist is used after that)
then you can't replace it with foreach,
else you can. :-)
Looking at showproc, it seems like the else-branch applies.
Btw, there is also a bug in the code!
If some argument does not have a default, it should still
be [list]-wrapped
% proc foo {{{bad thing}}} { return ${bad thing} }
% showproc foo ;# -> proc foo {{bad thing}} { return ${bad thing} }
One not-redundant(!) pair of braces has been lost :-(
.
- Follow-Ups:
- Re: examine or describe a proc?
- From: Andreas Leitgeb
- Re: examine or describe a proc?
- References:
- examine or describe a proc?
- From: Mike
- Re: examine or describe a proc?
- From: Torsten Edler
- Re: examine or describe a proc?
- From: R. T. Wurth
- Re: examine or describe a proc?
- From: suchodj
- Re: examine or describe a proc?
- From: suchenwi
- Re: examine or describe a proc?
- From: Uwe Klein
- examine or describe a proc?
- Prev by Date: Re: Anyone know the status of these 5 TIPs?
- Next by Date: Re: write binary file with struct in tcl
- Previous by thread: Re: examine or describe a proc?
- Next by thread: Re: examine or describe a proc?
- Index(es):