Sorry, I let this drop on the floor. Allow me to please make a rebuttal
before the issue is closed.
On Fri Feb 05 01:41:11 2010, NUFFIN wrote:
Show quoted text> try might be different from eval in the local semantics, but all of
> the differences are apparent in the lexical scope of usage.
I understand the distinction, but this is only relevant if you're
converting from eval to try. If you're writing new code with try then
it is perpetuating a known trap forward to support a handful of edge cases.
Even if you are converting, the overwhelming majority of uses of eval
and try will break if $SIG{__DIE__} is set. Find me one which will work
and I'll find you twenty which will not. I am serious.
Preserving this behavior just to make the differences between eval and
try lexical does not make sense. The global behavior $SIG{__DIE__} with
respect to eval is clearly dangerous and broken and generates bugs.
Show quoted text> Secondly, $SIG{__DIE__} can be used legitimately inside an eval, and
> has been many times before, I'm not going to break that because it
> will make using Try::Tiny a lot more difficult for me and many others.
Coded correctly, $SIG{__DIE__} can still be set inside an eval and
remain in effect outside of it. I've dealt with exactly this problem
before. You can see the code inside base.pm.
To make it more explicit...
try {
$SIG{__DIE__} = sub { ... };
};
I intend that will continue to work in that $SIG{__DIE__} remains set
outside of try.
The use case is this:
try {
require Module::Which::Sets::Sig::Die;
};
Show quoted text> Code that used to run in global contexts may be later reused inside an
> eval, thus causing behavior changes that are not directly evident.
As mentioned earlier in the ticket, blindly copying and pasting code
into try will already not work. The changes to return and $_ have a far
more practical effect, yet they were considered ok.
Show quoted text> You're also assuming that running -MDevel::NoGLobalSig=die would do
> full path coverage, which is most definitely not guaranteed, and
> precisely the combinatorial issue when bits of code that are not
> lexically adjacent interact with one another.
Sorry, I don't know what that means.
Show quoted text> I don't want another UNIVERSAL::isa on my hands, especially since
> Try::Tiny was not a tounge in cheek acme module to begin with.
The comparison to UNIVERSAL::isa is inverted. try() can only effect
code which uses try(). $SIG{__DIE__} is UNIVERSAL::isa. Used without
care, it effects all code and causes problems outside of its scope.
Try::Tiny already has the UNIVERSAL::isa problem, it was inherited from
eval. This is an opportunity to fix it.