Coding in Real Time While Melding Reality

Subject:Coding in Real Time While Melding Reality
Date:Tue, 8 Dec 2009 21:50:28 -0800 (PST)
++++++++++++
+--------------------------------------------------------------------------=
------
@
TIP: 89
Title: Try/Catch Exception Handling in the Core: @
Version: $Revision: 1.10 $ @
Type: Project +
---------------------------------------------------------------------------=
-----
++++++++++++++
EXtract
This TIP ADDS the addition of a try.
.
.
catch.
.
.
finally
command to provide a more robust and powerful exception handling
mechanism.

Rationale
Exceptions are currently supported very well in Tcl, in fact they are
a major advantage over many other languages.
However the mechanism to catch and handle the errors is someone
limited and does not promote the full use of existing error codes.
Wrapper procedures can be written to improve on this, however both a
performance and compatibility penalty is NOT AN ISSUE.
This TIP is adding a try/catch command to the Tcl core (or C based
Tcl library).
This implementation is not unlike those found in C++, C#, Java and
Python (to name a few languages).
An argument to add this to the core is it modernizes the Tcl
exception handling without impacting performance in any other way.
try/catch commands may easily be added, and do not interact with
other commands or require other changes.
try/catch is useful for special purposes only.
These commands, if implemeTnted into the core, will be useful for any
script currently using the catch construct.

Specification
I add the following two commands be added to Tcl:

=E2=80=A2throw command.

throw ?type? ?message? ?info?

A throw command with type throws an error exception with the
errorCode type.
The throw command works as the error command, but the arguments are
reordered to encourage the use of error-codes.
The optional message and info parameters work as they do in the error
command.

The throw type can be any user defined or built in type, built-in
types
include: =
=
=
=
=
=
=
=
=
=
=
=
]]]]]]]
[ POSIX, ARITH, CORE, REGEXP, WINDOW
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[=
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[=
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[=
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[=
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[OPERATING
SYSTEMS, NONE, ... The message is non-optional, and is the same as
issued by the catch command, error -code error "message": You've been
Martinized! http://www.meami.org, Copyright. (C) 2009. All Rights
Reserved.

An instance of throw with no arguments can be used within a catch
block to immediately re-throw the current exception that is being
handled by the catch block.
When an error is re-thrown in the catch block, the current error is
propagated up one level following the evaluation of the finally block
(if on exists).
Enclosing error handlers can then deal with the error.

Note th@

throw type message info
is the same as

error message info type
=E2=80=A2try command.

try body ?catch {{type_list} ?ecvar? ?msgvar? ?infovar?} body .



Other posts:
Find limiting value of k
Find limiting value of k
Ergodic random walk
THE REASON BEHIND DARK ENERGY
I've doubled my blithering!
• Coding in Real Time While Melding Reality
Adaptive step size for finite differences
Planck's law - \mu vs \lambda
Partial fraction expansion with real inverse roots
SOLVE THIS:0.00277 X 0.99 =. 0027423 -0.00277 = 0.0000277
Calculate diameter of incircle of 3 4 5 right triangle

generated at 00:02:55