On Sun, Dec 25, 2011 at 12:20 AM, Khat Harr <myphatproxy / hotmail.com> wrote:
> I hear what you say, but shouldn't that be something that gets handled
> by raise?

What do you mean by that?  raise is only for raising exceptions.
Handling is done in rescue blocks.  But there are also "ensure"
sections in begin end blocks.  Does this help?

http://blog.rubybestpractices.com/posts/rklemme/003-The_Universe_between_begin_and_end.html

> My implementation isn't what I'm worried about here, I already wrote the
> handler, and the implementation is intended for end-users to write
> scripts in.  ¨Βτ§κυστ τθατ χασυςπςισεβω χθατ στςυγλ νε ασ
> non-intuitive behavior.  ¨Β λξοχ εψιτβωπασσεσ θαξδμεςσ ¨Βαμχαωσ
> struck me that this was a means of getting around 'ensure'.  ¨Β§φαμχαωσ
> viewed exit as being for exiting and raise being for raising exceptions.
> Is there something I'm missing?

If you think about it a little more I am sure you'll notice what a
clever move it was to make exit raise an exception.  That way,
regardless of where it is invoked all stacks are unwound and all
ensure blocks can do their job to do proper resource cleanup.  For
example, if you invoke "exit" somewhere inside File.open { ... } the
file descriptor is properly closed which includes flushing data
written to the IO object but not yet handed over to the OS.

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/