Vasily Chekalkin wrote:

This is wrong patch. eval() shouldn't throws any exceptions.

Correct patch for 'eval()' and Test.pm attached.


As Mr Lenz wrote with respect to eval exceptions and this patch:

Are there any exceptions that are not caught by eval?
Currently rakudo seems to catch every run time exception,
/***** BUT PARSE FAILURES STILL THROW AN EXCEPTION. *****/
I'm pretty sure that's wrong, because
it's contrary to Perl 6's exception philosophy.

So eval() needs more work, but in the mean time your patch works just
fine (and it will continue to work when eval is fixed), so I vote +1 here.


For example:

eval 'my $x = 2; $x = $x / 0; say $x;'; say 'eval exception ', $!;
eval exception Divide by zero

eval 'my $x; my $y; ($x = $y) = 3; say $x;'; say 'eval exception ', $!;
Method 'lvalue' not found for invocant of class 'PAST::Stmts'

In the second case eval throws an exception and it would make sense for eval_dies_ok to catch it and report it as a case that died. The second case is from the pugs lvalue.t suite. I am currently doing work in that area and would like to use eval_(dies|lives)_ok for some tests including tests from lvalue.t.

Ron

Reply via email to