Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-03-25
02:05 • Closed ticket [533907ffff]: Tcl_EvalObjv: huh?! plus 7 other changes artifact: c08efacf5c user: msofer
2002-03-24
23:38 • Add attachment 533907.patch2 to ticket [533907ffff] artifact: 25df90f59a user: dgp
23:38 • Ticket [533907ffff] Tcl_EvalObjv: huh?! status still Open with 4 other chang... artifact: cc2908dcef user: dgp
23:38 • Ticket [533907ffff]: 4 changes artifact: 93fddef250 user: dgp
21:59 • Add attachment 533907.patch to ticket [533907ffff] artifact: 1f071ac8b9 user: msofer
21:59 • Ticket [533907ffff] Tcl_EvalObjv: huh?! status still Open with 4 other chang... artifact: e9560becf8 user: msofer
2002-03-23
12:21 • Ticket [533907ffff]: 1 change artifact: 6274faab7a user: dgp
05:16 • New ticket [533907ffff]. artifact: f292ac7c89 user: dgp

Tcl_EvalObjv: huh?!

Closed / Fixed533907ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-03-23 05:16:19
The routine Tcl_EvalObjv is a monstrosity of
obfuscation.  Surely we can rewrite it to be more
clear.

If I'm deciphering it correctly, it appears that
when evaluation returns TCL_ERROR, then
Tcl_LogCommandInfo will be called -- *EXCEPT* when
it has been detected that a trace on the command
might be in place.  In that case, cmdLen will
not be zero, and the "goto cmdtraced" will not
be taken.  That's good, because we don't need
to generate the cmdString since it's already done.
But it's bad because without that goto, we fall
out of the switch and never call Tcl_LogCommandInfo,
which is what we constructed the cmdString for in
the first place!

Recent efforts to improve command tracing (TIPs 32, 79)
and pending efforts to expose command tracing at the
script level (TIP 62) will make it more important to
get this case correctly handled.
dgp Ticket [533907ffff]: 1 change [History diff]2002-03-23 12:21:13
msoferplain2002-03-24 21:59:30
File Added - 19936: 533907.patch

Logged In: YES 
user_id=148712

Indeed, it is quite obscure coding - and wrong too, as you
point out.

I'd propose to duplicate the small string-generation code
for the sake of clarity, as implemented in the enclosed
patch. Comments? Should we avoid the code duplication with a
couple of "goto"?
dgpplain2002-03-24 23:38:21
Logged In: YES 
user_id=80530

I think the duplication is fine;  it's small enough.

If anyone does want to get rid of the duplication, then
I say write a new function instead of goto.

Here's a revised patch that changes only comments
and formatting to keep things within 80 columns.
dgpplain2002-03-24 23:38:22
File Added - 19943: 533907.patch2
msoferplain2002-03-25 02:05:51
Logged In: YES 
user_id=148712

Patch committed.
Log in (anonymous is fine) to add a comment.

Attachments: