LazyLoad

Quoting Erik V. [email protected]:

I got it. I introduced LazyException (see below) as a wrapper
for the original Exception. All methods are (once again)
delegated to the original exception with method_missing, except
for LazyException#exception.

Hmm. Interesting. I hadn’t considered making DivergenceError
delegate to its “parent” exception… I’ll have to think about
that.

Incidentally, there may be some threadsafety issues around the
exception’s backtrace array.

(Imagine two LazyExceptions in different threads getting raised
simultaneously for the same parent exception – how will the
backtraces accumulate, exactly? There may not be a problem, but I
think it bears investigation…)

-mental

(Imagine two LazyExceptions in different threads getting
raised simultaneously for the same parent exception – how
will the backtraces accumulate, exactly? There may not be a
problem, but I think it bears investigation…)

There can’t be two LazyExceptions with the same “original”
exception. The LazyException is created and stored in
[email protected]xcpetion in the Mutex#synchronize block, along with
[email protected]

It can be thrown multiple times, concurrently, though. But
since both [email protected] and [email protected] are
built when they are created (they are, aren’t they?), I don’t
see a problem.

gegroet,
Erik V. - http://www.erikveen.dds.nl/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs