Author: tene Date: Thu Sep 18 01:47:46 2008 New Revision: 31223 Modified: trunk/docs/pdds/pdd19_pir.pod trunk/docs/pdds/pdd23_exceptions.pod
Changes in other areas also in this revision: Modified: trunk/compilers/bcg/t/BCG.t trunk/compilers/pct/src/PAST/Compiler.pir trunk/compilers/pct/src/PCT/HLLCompiler.pir trunk/docs/compiler_faq.pod trunk/languages/APL/src/parser/actions.pm trunk/languages/WMLScript/src/wmlsstdlibs.pir trunk/languages/WMLScript/wmls2pbc.pir trunk/languages/WMLScript/wmls2pir.pir trunk/languages/WMLScript/wmlsd.pir trunk/languages/WMLScript/wmlsi.pir trunk/languages/dotnet/build/translator.pl trunk/languages/dotnet/src/translator.pir trunk/languages/ecmascript/src/parser/actions.pm trunk/languages/forth/forth.pir trunk/languages/forth/test.pir trunk/languages/lua/luac2pir.pir trunk/languages/lua/luad.pir trunk/languages/lua/src/lib/bc.pir trunk/languages/lua/src/lib/glut.pir trunk/languages/lua/src/lib/lfs.pir trunk/languages/lua/src/lib/luaaux.pir trunk/languages/lua/src/lib/luabasic.pir trunk/languages/lua/src/lib/luacoroutine.pir trunk/languages/lua/src/lib/luadebug.pir trunk/languages/lua/src/lib/luaos.pir trunk/languages/perl6/src/builtins/control.pir trunk/languages/perl6/src/parser/actions.pm trunk/languages/pheme/pheme.pir trunk/languages/squaak/src/parser/actions.pm trunk/languages/tcl/runtime/builtin/dict.pir trunk/languages/tcl/runtime/builtin/info.pir trunk/languages/tcl/runtime/builtin/inline.pir trunk/languages/tcl/runtime/conversions.pir trunk/languages/tcl/src/macros.pir trunk/languages/tcl/t/internals/select_option.t trunk/languages/tcl/t/internals/select_switches.t trunk/src/exceptions.c trunk/src/ops/core.ops trunk/src/pmc/exception.pmc trunk/t/compilers/pge/p5regex/p5rx.t trunk/t/compilers/pge/perl6regex/01-regex.t trunk/t/library/pg.t trunk/t/op/calling.t trunk/t/op/exceptions.t trunk/t/op/sprintf.t trunk/t/pmc/bigint.t trunk/t/pmc/complex.t trunk/t/pmc/coroutine.t trunk/t/pmc/exception.t trunk/t/pmc/float.t trunk/t/pmc/namespace.t trunk/t/pmc/resizablestringarray.t Log: Revert my previous exceptions commit. It was wrong. Modified: trunk/docs/pdds/pdd19_pir.pod ============================================================================== --- trunk/docs/pdds/pdd19_pir.pod (original) +++ trunk/docs/pdds/pdd19_pir.pod Thu Sep 18 01:47:46 2008 @@ -617,15 +617,18 @@ Using the C<push_eh> op you can install an exception handler. If an exception is thrown, Parrot will execute the installed exception handler. In order to retrieve the thrown exception, use the C<.get_results> directive. This -directive always takes 2 arguments: an exception object and a return -continuation. +directive always takes 2 arguments: an exception object and a message string. + +{{ NOTE: Wouldn't it be more useful to make this flexible, or at least only +the exception object? The message can be retrieved from the exception object. +See RT #57436 }} push_eh handler ... handler: .local pmc exception - .local pmc continuation - .get_results (exception, continuation) + .local string message + .get_results (exception, message) ... This is syntactic sugar for the C<get_results> op, but any flags set on the @@ -633,15 +636,6 @@ The C<.get_results> directive must be the first instruction of the exception handler; only declarations (.lex, .local) may come first. -To resume execution after handling the exception, just invoke the continuation -parameter. - - ... - .get_results(exception,continuation - ... - continuation() - ... - =head2 Syntactic Sugar Any PASM opcode is a valid PIR instruction. In addition, PIR defines some Modified: trunk/docs/pdds/pdd23_exceptions.pod ============================================================================== --- trunk/docs/pdds/pdd23_exceptions.pod (original) +++ trunk/docs/pdds/pdd23_exceptions.pod Thu Sep 18 01:47:46 2008 @@ -66,17 +66,18 @@ =item B<throw I<EXCEPTION> [ , I<CONTINUATION> ]> -Throw the given I<EXCEPTION> PMC to the active exception handlers. -If a I<CONTINUATION> is not passed in, throw will take a new one at -the next opcode. Active exception handlers (if any) will be -invoked with I<EXCEPTION> and the given continuation as parameters. +Throw an exception consisting of the given I<EXCEPTION> PMC, after taking a +continuation at the next opcode. When a I<CONTINUATION> is passed in, it will +use that instead of generating a new continuation. Active exception handlers +(if any) will be invoked with I<EXCEPTION> as the only parameter, and the +return continuation stored within that exception object. PMCs other than Parrot's Exception PMC may also be thrown, but they must support the interface of an Exception PMC. An HLL may implement throwing any arbitrary type of PMC, by storing that PMC as the payload of an Exception PMC. Exception handlers can resume execution immediately after the C<throw> opcode -by invoking the resume continuation which is passed in as the second argument. +by invoking the resume continuation which is stored in the exception object. That continuation must be invoked with no parameters; in other words, C<throw> never returns a value.