From: Mathieu Bouchard Date: 2005-03-03T03:24:56+09:00 Subject: Re: Continuation example On Wed, 2 Mar 2005, ES wrote: > > It'd be great fun if exception handling could *literally* be described > parallel to the method :) You need "around-methods", an AOP concept taken from CommonLISP. You define the error handler as an around-method called foo, put a begin/rescue/ensure block that normally just runs "super", which calls the supermethod, which is not necessarily in a superclass. In this case, what gets run is the regular-method foo of the same class. You can achieve a similar effect without AOP by putting error handling in foo() and the code in foo_real(). An alternative is to have two classes instead, and put the error-handling in the subclass. This is what MetaRuby (matju's) did to achieve contract-checking. However it doesn't lend itself to subclassing, as the first foo is executed inside the error handling (the 2nd foo) but the 3rd foo is executed outside of it. _____________________________________________________________________ Mathieu Bouchard -=- Montr�al QC Canada -=- http://artengine.ca/matju