From: "Phlip" <phlip_cpp / yahoo.com>
>
[...]
> So consider this pseudo Ruby:
> 
>   aConcept = Concept.new
>   begin
>      doStuffThatMightRaise (aConcept)
>   ensure
>      aConcept.changeMouse(Arrow)
>   end
> 
> In this code, we are forced to know that Concept has side-effects, and that 
> these must be rolled-back before the current function exits. This means we 
> must couple the calling code to what the called code needs, and its 
> interface is not as narrow as it could be. We called no method on aConcept 
> that change the mouse pointer away from an arrow, but we must still change 
> it back reliably.

Perhaps I'm missing the point, but if the above is an example of
something that _could_ have been handled in C++, say, with RAII,
. . . then mightn't we add a more generic 'destroy' method to our
Concept class?

  aConcept = Concept.new
  begin
     doStuffThatMightRaise (aConcept)
  ensure
     aConcept.destroy
  end

My point being that if it could have been handled by the C++ destructor
without bringing details like changeMouse() outside the class, than we
should be able to mimic that, even if we have to call the dtor manually.
(Sorry if I'm stating the obvious :)


Regards,

Bill