You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 fromeval
.It turns out that
return
will return from theeval
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.
The text was updated successfully, but these errors were encountered: