Tcl Source Code

View Ticket
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Ticket UUID: 536838
Title: [subst] doc clarification
Type: Bug Version: obsolete: 8.4a5
Submitter: dgp Created on: 2002-03-29 18:39:25
Subsystem: 18. Commands M-Z Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2002-04-18 23:31:54
Resolution: Fixed Closed By: dgp
    Closed on: 2002-04-18 16:31:54
Description:
It should be noted that the -no* options to
[subst] only influence the "top level" of
substitution.  Even with -novar, variable
substitutions do take place with command
substitutions, and even with -nocommands,
command substitutions do take place within
variable substitutions (array indices).

% set a 1        
1
% subst -novar {$a [string equal $a 1]}
$a 1

% proc b {} {return c}  
% array set foo {c c b b [b] tricky}
% subst -nocommands {[b]$foo([b])}
[b]c
User Comments: dgp added on 2002-04-18 23:31:54:
Logged In: YES 
user_id=80530

committed to HEAD (8.4a5)

dkf added on 2002-04-18 20:28:16:
Logged In: YES 
user_id=79902

Documentation change looks good to me; assigning back to you
for application.

(I was actually interested in what was meant by the handling
of TCL_RETURN, though I'd like to note that I've always
found it easier to pass that sort of thing using the
::errorCode variable.)

dgp added on 2002-04-06 04:19:20:
File Added - 20637: sdoc.patch

Logged In: YES 
user_id=80530

Here's a patch.

dkf added on 2002-04-05 15:46:41:
Logged In: YES 
user_id=79902

Care to submit a detailed description of what you're after?

dgp added on 2002-03-30 02:28:10:
Logged In: YES 
user_id=80530

Actually, [return] acts much like [continue].

Said another way, [continue] is equivalent to [return ""].

Extended return codes too.

dgp added on 2002-03-30 01:57:46:
Logged In: YES 
user_id=80530


It should also be noted that [subst] can only have a
return code of TCL_OK or TCL_ERROR.  If a substitution
yields some other return code, notably TCL_RETURN, but
other extended return codes as well, they are effectively
converted to TCL_OK.

I seem to recall Brent Welch wishing for a means to
return extended return codes from [subst] for use in
web page template processing so that something like

subst {
# lots of template stuff with a
return -code 404 "Page not found"
# blah
}

could be used.

Attachments: