Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Try::Tiny to TryCatch. #224

Open
schwern opened this issue Jul 7, 2012 · 0 comments
Open

Switch from Try::Tiny to TryCatch. #224

schwern opened this issue Jul 7, 2012 · 0 comments

Comments

@schwern
Copy link
Contributor

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
Projects
None yet
Development

No branches or pull requests

1 participant