Switch from Try::Tiny to TryCatch. #224

schwern opened this Issue Jul 7, 2012 · 0 comments


None yet
1 participant

schwern commented Jul 7, 2012

Try::Tiny has been useful, but it has a lot of caveats.

Now that we're using Devel::Declare, TryCatch is a possible replacement for Try::Tiny.

There are some issues:

It uses Moose

This adds unacceptable load time. It only uses this to parse the catch signatures (via Parse::Method::Signatures). It's possible a stripped down version of TryCatch could be written, with pluggable catch signatures, and TryCatch is built on top of that using Parse::Method::Signatures. Our own would use perl5i's internal signature handling.

Don't actually know if its any faster

This would require some benchmarking. Put your results on this issue as a comment.

The behavior of return is different from eval.

It turns out that return will return from the eval block, not the enclosing subroutine. This is surprising to me, I'd never thought it would do this, and quite patently wrong. So that TryCatch behaves differently is a bonus IMO but would be a big incompatibility.

Its incompatible with Try::Tiny

Thus this would have to be a perl5i::3 feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment