On Jun 29, 3:43 ¨Âí¬ ¢Äáöéä Á® Âìáãë¢ ¼äâì®®®Àòõâùðáì®ãïí¾ ÷òïôåº
> I think Yossef is talking about a case where something like this:
>
>  ¨Âåçéî
>  ¨Âåñõéòå §óïíåôèéîç>  ¨ÂåóãõÌïáäÅòòï>  ¨Âõô¢Óïòòù>  ¨Âìó>  ¨Â Óïíåôèéîç®îå>  ¨Âîä
>
> could be done like this instead:
>
>  ¨Âåçéî
>  ¨Âåñõéòå §óïíåôèéîç>  ¨Â Óïíåôèéîç®îå>  ¨ÂåóãõÌïáäÅòòï>  ¨Âõô¢Óïòòù>  ¨Âîä

Basically, yes.

> There's another thread going in which I've stumbled through several
> iterations of advice to someone about exactly this problem, and
> essentially ended up with that last one. A great example of
> cross-thread heterodyning :-)

I saw that. One thing that could be said about the

    begin
      require 'something'
    rescue LoadError
      puts "Sorry"
    else
      m = Something.new
    end

example is that it gets the exception out of the way quickly and then
you can easily see the body of code that matters. That order makes it
clear that the begin/rescue is only to safely wrap the optional code
that would execute if you only had the right library present (or gem
installed).

On the other hand, structuring it as

    begin
      require 'something'
      m = Something.new
    rescue LoadError
      puts "Sorry"
    end

would leave you hanging if the optional code is substantial. You could
have to look down a bit before realizing why the begin block was even
there.

--
-yossef