Skip to content
Tcl Source Code View Ticket
Login

View Ticket

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: