Paul Brannan wrote:
> Is this just an optimization that e and $! are the same place on the
> stack?  Assigning to e does not change $!.

I missed.  $! looking rb_thread_t#errinfo.

> 1. Why do you choose to use a local variable to store errinfo in YARV?
>    It was thread-local (global variable that is swapped when the thread
>    is swapped) in 1.8.

How about such an example?

def m
  raise Thread.current[:err] = 'bar'
rescue
end
begin

  raise Thread.current[:err] = 'foo'
rescue
  m
  p $! #=> #<RuntimeError: foo>
  p Thread.current[:err] #=> "bar"
end

BTW, 1.8 also solved such problem.  This shows that 1.8 doesn't use
thread local variable (TLV) for errinfo (yes, it use TLV, but not
only TLV).


> 2. On 1.8 it was possible to assign to $!, but this has been disabled on
>    YARV.  Is there a particular reason?

It was only implementation issues.  I suggested to remove it on
[ruby-dev:31484] to simplify spec/impl, and it accepted.

[ruby-core:19419]
> Also, I had been curious whether rb_rubylevel_errinfo() should be
> declared in ruby.h.

really?  on the trunk?

-- 
// SASADA Koichi at atdot dot net