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

'use fatal' is dynamically scoped, but should be lexically scoped in Rakudo #3183

Closed
p6rt opened this issue Jul 6, 2013 · 4 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 6, 2013

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

Searchable as RT118785$

@p6rt
Copy link
Author

p6rt commented Jul 6, 2013

From @masak

<TimToady> r​: https://gist.github.com/anonymous/5940348
<camelia> rakudo 0eab21​: OUTPUT«1..1␤open is disallowed in restricted
setting [...]
<TimToady> well, anyway, that gist is the rakudobug I was carping
about last night, where $*FATAL doesn't turn off in non-fatal scopes
* masak runs it locally
* masak submits rakudobug

## Here's the contents of the gist, for completeness​:

use Test;
plan 1;

sub fatalscope (&todo) {
  use fatal;
  todo;
}

sub nonfatalscope {
  open("NoneSuch") or $*IN;
}

is fatalscope(&nonfatalscope), $*IN, "Fatal scopes are lexical rather
than dynamic";

## Here's my local run​:

$ perl6 TimToady-gist-5940348
1..1
Unable to open filehandle from path 'NoneSuch'​: No such file or directory(2)
  in method open at src/gen/CORE.setting​:11474
  in method open at src/gen/CORE.setting​:11464
  in sub open at src/gen/CORE.setting​:11874
  in sub open at src/gen/CORE.setting​:11872
  in sub nonfatalscope at daosni​:10
  in sub fatalscope at daosni​:6
  in block at daosni​:13

# Looks like you planned 1 tests, but ran 0

@p6rt
Copy link
Author

p6rt commented May 1, 2015

From @jnthn

On Sat Jul 06 09​:25​:38 2013, masak wrote​:

<TimToady> r​: https://gist.github.com/anonymous/5940348
<camelia> rakudo 0eab21​: OUTPUT«1..1␤open is disallowed in restricted
setting [...]
<TimToady> well, anyway, that gist is the rakudobug I was carping
about last night, where $*FATAL doesn't turn off in non-fatal scopes
* masak runs it locally
* masak submits rakudobug

## Here's the contents of the gist, for completeness​:

use Test;
plan 1;

sub fatalscope (&todo) {
use fatal;
todo;
}

sub nonfatalscope {
open("NoneSuch") or $*IN;
}

is fatalscope(&nonfatalscope), $*IN, "Fatal scopes are lexical rather
than dynamic";

## Here's my local run​:

$ perl6 TimToady-gist-5940348
1..1
Unable to open filehandle from path 'NoneSuch'​: No such file or directory(2)
in method open at src/gen/CORE.setting​:11474
in method open at src/gen/CORE.setting​:11464
in sub open at src/gen/CORE.setting​:11874
in sub open at src/gen/CORE.setting​:11872
in sub nonfatalscope at daosni​:10
in sub fatalscope at daosni​:6
in block at daosni​:13

# Looks like you planned 1 tests, but ran 0

The correct 'use fatal' semantics got implemented recently. I massaged this test case into a more robust one and added it in S04-exceptions/fail.t; it's passing.

@p6rt
Copy link
Author

p6rt commented May 1, 2015

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

@p6rt
Copy link
Author

p6rt commented May 1, 2015

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

@p6rt p6rt closed this as completed May 1, 2015
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant