Tcl Source Code

View Ticket
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Ticket UUID: 684982
Title: remove TCL_BRACKET_TERM
Type: RFE Version: None
Submitter: dgp Created on: 2003-02-11 23:09:26
Subsystem: 45. Parsing and Eval Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-03-13 10:00:33
Resolution: Accepted Closed By: dgp
    Closed on: 2003-03-13 03:00:33
Description:
One of the flag values that can be
set in interp->evalFlags is
TCL_BRACKET_TERM.

Setting this causes both
Tcl_EvalEx() and TclSetByteCodeFromAny()
to parse only to the next unquoted close-bracket
when do evaluation or compilation in
the interp.

The only user of this power appears to
be the command substitution portion
of the [subst] command.

It seems to me that the same effect
could be achieved by appropriate
calls to Tcl_ParseCommand() with
its documented "nested" argument,
rather than hacking around the
internals of the interp structure.
User Comments: dgp added on 2003-03-13 10:00:33:
Logged In: YES 
user_id=80530

alternative patch committed to HEAD.

test away!

dgp added on 2003-03-13 09:39:58:
File Added - 44904: 684982-alt.patch

Logged In: YES 
user_id=80530

Alternative patch encloses
the alternative patch for
Tcl FR 536831

dgp added on 2003-03-09 04:40:56:
File Added - 44459: 684982.patch

dgp added on 2003-03-09 04:40:55:
Logged In: YES 
user_id=80530

this patch includes the patch
for FR 536831, but also
includes the removal of
lots of dead code, including
TCL_BRACKET_TERM,
iPtr->termOffset, and the
"nested" argument to
TclCompileScript.  None
of this is needed after [subst]
uses more standard means to
do its work.

dgp added on 2003-02-13 09:03:39:
Logged In: YES 
user_id=80530

there's probably an opportunity
to get rid of iPtr->termOffset
as well.

dkf added on 2003-02-12 16:30:26:
Logged In: YES 
user_id=79902

If you can figure out how to change Tcl_SubstObj() to not
use TCL_BRACKET_TERM, you have my blessing to do it that
way.  Personally, I think it is getting very close to
cargo-cult junk, and it is certainly making other parts of
the core more complex.

(FWIW, I looked into dumping the flag when I split [subst]
into two parts, but got lost in the tangle below and gave
up.)

dgp added on 2003-02-12 07:03:03:
Logged In: YES 
user_id=80530

The TclPro program tclcompiler
directly calls TclSetByteCodeFromAny,
so it's possible it cares about this
TCL_BRACKET_TERM matter.

dgp added on 2003-02-12 06:19:32:
Logged In: YES 
user_id=80530

Using the Tcl test suite as
a poor man's coverage test
for the Tcl source code, it
appears that the code
testing for TCL_BRACKET_TERM
being set in 
TclSetByteCodeFromAny()
is never active.

If that's true, then TCL_BRACKET_TERM
appear to exist only to configure a
particular mode of operation in Tcl_EvalEx().
Would be better not to call Tcl_EvalEx()
at all, but use Tcl_ParseCommand() and
friends within Tcl_SubstObjCmd

Attachments: