|
2002-04-16
| ||
| 00:45 | • Closed ticket [536955ffff]: improve break error strack trace plus 7 other ... artifact: 4c5afad4e3 user: msofer | |
|
2002-04-06
| ||
| 04:52 | • Ticket [536955ffff]: 4 changes artifact: 0d9378e0a1 user: dgp | |
| 04:52 | • Add attachment proc.patch3 to ticket [536955ffff] artifact: 3e39f650f1 user: dgp | |
|
2002-03-31
| ||
| 00:31 | • Ticket [536955ffff] improve break error strack trace status still Open wit... artifact: d12736a936 user: dgp | |
|
2002-03-30
| ||
| 09:19 | • Ticket [536955ffff]: 4 changes artifact: e720bd526b user: msofer | |
| 07:26 | • Ticket [536955ffff]: 4 changes artifact: dad65c517f user: dgp | |
| 07:15 | • Ticket [536955ffff]: 4 changes artifact: 2906bbf910 user: dgp | |
| 07:13 | • Ticket [536955ffff]: 4 changes artifact: 467d2b0ee9 user: dgp | |
| 06:52 | • Ticket [536955ffff]: 4 changes artifact: 414153d64a user: dgp | |
|
2002-03-29
| ||
| 23:50 | • New ticket [536955ffff]. artifact: 96c6a3f335 user: dgp | |
improve [break] error strack trace
Closed / Accepted536955ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-03-29 23:50:10
% info patch
8.3.4
% proc mybreak {} {return -code break}
% catch mybreak
3
% proc breaktest {} {mybreak}
% list [catch breaktest msg] $msg
1 {invoked "break" outside of a loop}
% proc lucky {} {return -code 7}
% catch lucky
7
% proc luckytest {} {lucky}
% list [catch luckytest msg] $msg
7 {}
It would be more consistent if the only way
to pass back a non-TCL_OK, non-TCL_ERROR
return code from a proc was by using the
[return -code] command itself.
I'd rather see:
% list [catch luckytest msg] $msg
1 {command returned bad code: 7}
dgpplain2002-03-30 06:52:53
Logged In: YES
user_id=80530
A related problem:
% proc test {} {
# Imagine hundreds of lines here
break
# And hundreds more
}
% test
invoked "break" outside of a loop
% set errorInfo
invoked "break" outside of a loop
while executing
"test"
Would be much better if ProcessProcResultCode
not only converted TCL_BREAK -> TCL_ERROR, but
also added good context to the ErrorInfo.
dgpplain2002-03-30 07:13:02
File Added - 20299: proc.patch Logged In: YES user_id=80530 Here's a patch that does both things.
dgpplain2002-03-30 07:15:46
File Deleted - 20299: File Added - 20300: proc.patch Logged In: YES user_id=80530 D'oh! Let's try that patch again...
dgpplain2002-03-30 07:26:31
File Added - 20301: proc.patch2 Logged In: YES user_id=80530 updated patch contains changes to test suite too
msoferplain2002-03-30 09:19:53
Logged In: YES user_id=148712 I'm not sure about this one: it could break a lot of user code, and destroy functionality that I think is valuable. In particular, custom exception handling code may depend on the return code being passed up the stack, without requiring every intervening command to catch/rethrow the exception code. This would force such code to either catch/rethrow at each stage, or else to do receive a TCL_ERROR and pass the exception type in a different manner - quite an expensive proposition (see the latest catch.bench in tclbench).
dgpplain2002-03-31 00:31:39
Logged In: YES user_id=80530 After sleeping on it, I agree that the inconsistency argument doesn't make sense. Yes, [return -code 7] is inconsistent with [return -code break], but it is consistent with [return -code error]. One had to be chosen, and the choice is already made and should not be changed now. I think I've heard of some people defining an "exit" return code to give them a way to exit their program. That usage needs the "exception-like" behavior of extended return codes. What do you think about the improved stack trace for [break] and [continue] errors though?
dgpplain2002-04-06 04:52:25
File Deleted - 20301: File Added - 20639: proc.patch3 Logged In: YES user_id=80530 Here's an updated patch that only improves the stack trace for [break] and [continue].
msoferplain2002-04-16 00:45:54
Logged In: YES user_id=148712 Committed the improved stack trace patch.
Log in (anonymous is fine) to add a comment.
Attachments:
- proc.patch3 [download] added by dgp on 2002-04-06 04:52:25. [details]