Skip Menu |
Report information
Id: 133268
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: comdog <brian.d.foy [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



From: brian d foy <brian.d.foy [...] gmail.com>
Subject: MoarVM with empty CONTROL {}
Date: Fri, 8 Jun 2018 18:10:21 -0400
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 824b
While running this program I get a MoarVM panic: 2 + 2 = 4 'two' is not numeric MoarVM panic: Trying to unwind over wrong handler The program: sub add-two-things ( $first, $second ) { CATCH { when X::Str::Numeric { fail q/One of the arguments wasn't a number/ } } for $first, $second { warn "'$_' is not numeric" unless val($_) ~~ Numeric; } return $first + $second; } my @items = < 2 2 3 two nine ten 1 37 0 0 >; for @items -> $first, $second { CONTROL {} my $sum = add-two-things( $first, $second ); put $sum.defined ?? "$first + $second = $sum" !! "You can't add $first and $second"; } -- brian d foy <brian.d.foy@gmail.com> http://www.pair.com/~comdog/

Golf:

CONTROL {}; warn 42

On 2018-06-08 15:11:08, comdog wrote:
> While running this program I get a MoarVM panic:
>
> 2 + 2 = 4
> 'two' is not numeric
> MoarVM panic: Trying to unwind over wrong handler
>
> The program:
>
> sub add-two-things ( $first, $second ) {
> CATCH {
> when X::Str::Numeric {
> fail q/One of the arguments wasn't a number/
> }
> }
>
> for $first, $second {
> warn "'$_' is not numeric" unless val($_) ~~ Numeric;
> }
>
> return $first + $second;
> }
>
> my @items = < 2 2 3 two nine ten 1 37 0 0 >;
>
> for @items -> $first, $second {
> CONTROL {}
> my $sum = add-two-things( $first, $second );
>
> put $sum.defined ??
> "$first + $second = $sum" !!
> "You can't add $first and $second";
> }
>


 

RT-Send-CC: perl6-compiler [...] perl.org
On Fri, 08 Jun 2018 15:24:32 -0700, alex.jakimenko@gmail.com wrote: Show quoted text
> Golf: > > CONTROL {}; warn 42 > > On 2018-06-08 15:11:08, comdog wrote:
> > While running this program I get a MoarVM panic: > > > > 2 + 2 = 4 > > 'two' is not numeric > > MoarVM panic: Trying to unwind over wrong handler > > > > The program: > > > > sub add-two-things ( $first, $second ) { > > CATCH { > > when X::Str::Numeric { > > fail q/One of the arguments wasn't a number/ > > } > > } > > > > for $first, $second { > > warn "'$_' is not numeric" unless val($_) ~~ Numeric; > > } > > > > return $first + $second; > > } > > > > my @items = < 2 2 3 two nine ten 1 37 0 0 >; > > > > for @items -> $first, $second { > > CONTROL {} > > my $sum = add-two-things( $first, $second ); > > > > put $sum.defined ?? > > "$first + $second = $sum" !! > > "You can't add $first and $second"; > > } > >
This is a dupe of https://github.com/MoarVM/MoarVM/issues/572 (also filed in Rakudo's repo: https://github.com/rakudo/rakudo/issues/1605 ) Closing this ticket in favour of those Issues.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org