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

MoarVM with empty CONTROL {} #6686

Closed
p6rt opened this issue Jun 8, 2018 · 5 comments
Closed

MoarVM with empty CONTROL {} #6686

p6rt opened this issue Jun 8, 2018 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 8, 2018

Migrated from rt.perl.org#133268 (status was 'resolved')

Searchable as RT133268$

@p6rt
Copy link
Author

p6rt commented Jun 8, 2018

From @briandfoy

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/

@p6rt
Copy link
Author

p6rt commented Jun 8, 2018

From @AlexDaniel

  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";
  > }
  >
 
 
   

@p6rt
Copy link
Author

p6rt commented Jun 8, 2018

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jun 9, 2018

From @zoffixznet

On Fri, 08 Jun 2018 15​:24​:32 -0700, alex.jakimenko@​gmail.com wrote​:

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 MoarVM/MoarVM#572 (also filed in Rakudo's repo​: rakudo/rakudo#1605 )

Closing this ticket in favour of those Issues.

@p6rt
Copy link
Author

p6rt commented Jun 9, 2018

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant