[MacRuby-devel] Return from thread context

Perry Smith pedzsan at gmail.com
Fri Jul 10 12:44:47 PDT 2009


On Jul 10, 2009, at 1:58 PM, Laurent Sansonetti wrote:

> Indeed, raising an exception is very slow for us since we use C++  
> exceptions, but  it's only used in exceptional cases, or in very  
> explicit use cases like returning from a block (the other return  
> statements don't use an exception).  Also the new runtime in the  
> upcoming version of Mac OS X seems to be faster.

I'm not sure we are both on the same page yet.

In your examples:

1.times { p 42 }

after the "p 42" there is a return.  Perhaps not a return statement  
but a return.  Also, there is no ensure and no way to put an ensure in  
without a "begin / end" pair.

So, what I'm suggesting is to make:

begin
   foo
   return here
rescue
   dog
end

be the special case.  Not:

1.times { return 18 }

I'm guessing that is what you are doing but I wasn't sure.

Perry



More information about the MacRuby-devel mailing list