On Nov 23, 2007 12:06 PM, Dave Thomas <dave / pragprog.com> wrote:
> In 1.8, I could write:
>
>    def do_until(cond)
>      return if cond
>      yield
>      retry
>    end
>
>    i = 0
>
>    do_until(i > 10) do
>      print i, " "
>      i += 1
>    end
>
>
> In 1.9, this now reports
>
>    t.rb:4: Illegal retry
>
>
> Is this a deliberate change?

I hope so... see ruby-core[13259] for a thread on this. I originally
started looking into this when experimenting with edge case
differences between MRI and JRuby. The problem is that the code below
doesn't really do what you hope it does. It does a little too much in
fact.

If we are interested in keeping the ability to define control
structures this way for future ruby implementations, maybe we need a
more specific feature or finer tuning on the semantics of retry
outside of rescue's context.

Brian.