Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2009-10-02
02:16 • Closed ticket [1553630fff]: standardize subst exception treatment plus 7 o... artifact: fb50df39f3 user: dgp
2007-02-23
00:48 • Ticket [1553630fff]: 7 changes artifact: 2d6c3c908a user: dgp
00:45 • Ticket [1553630fff]: 4 changes artifact: 4c8e322a2b user: dgp
2007-02-22
05:42 • Ticket [1553630fff]: 4 changes artifact: 396ba63059 user: dkf
02:20 • Ticket [1553630fff]: 4 changes artifact: f7f4c437ec user: dgp
2006-11-29
20:34 • Ticket [1553630fff]: 1 change artifact: 529e1b0d6c user: dgp
2006-11-23
03:21 • Ticket [1553630fff]: 1 change artifact: 2a1ec6e518 user: dgp
2006-09-30
08:21 • Ticket [1553630fff]: 1 change artifact: bf002da200 user: msofer
2006-09-07
03:00 • Ticket [1553630fff]: 4 changes artifact: 50db6e3157 user: dgp
2006-09-06
19:44 • New ticket [1553630fff]. artifact: c98935a978 user: dgp

standardize [subst] exception treatment

Closed / Rejected1553630fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 17 years ago
Descriptionplain2006-09-06 19:44:46
Question arose on the chat:

% catch {subst {0[return -level 0 -code 6 foo]1}} m o  
0
% set m
0foo1
% set o
-code 0 -level 0

Should [subst] really be swallowing
up extension exception codes like that?
dgpplain2006-09-07 03:00:22
Logged In: YES 
user_id=80530


It appears that the interface
for Tcl_SubstObj() is a contributor
to this "design".

Since it returns either NULL, or
the substituted result, it has no
way to indicate other types of
exception conditions.  Thus, as
implemented, [subst] is similarly
constrained.

Seems similar in spirit to the
problem that Tcl_EvalTokens()
had.
msofer Ticket [1553630fff]: 1 change [History diff]2006-09-30 08:21:35
dgp Ticket [1553630fff]: 1 change [History diff]2006-11-23 03:21:09
dgp Ticket [1553630fff]: 1 change [History diff]2006-11-29 20:34:00
dgpplain2007-02-22 02:20:36
Logged In: YES 
user_id=80530
Originator: YES


Note that this (mis-)behavior
appears to be an obstacle to
bytecompiling [subst], since
any compiled version would have
to match these non-standard
treatments of exception codes.
dkfplain2007-02-22 05:42:11
Logged In: YES 
user_id=79902
Originator: NO

The current non-standard exception code handling in [subst] is probably "because it happened to be convenient to implement that way". I'd not stand in the way of any represenation that it is a bug that needs fixing...
dgpplain2007-02-23 00:45:25
Logged In: YES 
user_id=80530
Originator: YES


upon further review, the feasibility/ease
of bytecompiling [subst] is mostly
independent of this issue.  Even if
[subst] had always handled extension
exception codes in a standard way, a
byte compiled version of [subst] would
still need special crafting to duplicate
[subst]'s handling of the break, continue,
and return codes from Tcl's built-in set.
dgpplain2007-02-23 00:48:38
data_type - 360894

Logged In: YES 
user_id=80530
Originator: YES


Doc review also reveals that
the behavior noted in the
original report here did get
documented in Tcl 8.4, so 
making changes is a matter of
a (mildly incompat) Feature
Request, not a bug report.
Shifting report to the RFE Tracker...
dgpplain2009-10-02 02:16:58
allow_comments - 1
Log in (anonymous is fine) to add a comment.