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

array binding causes failures to be thrown #3161

Closed
p6rt opened this issue Jun 9, 2013 · 6 comments
Closed

array binding causes failures to be thrown #3161

p6rt opened this issue Jun 9, 2013 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jun 9, 2013

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

Searchable as RT118397$

@p6rt
Copy link
Author

p6rt commented Jun 9, 2013

From @labster

labster​: r​: sub foo { X​::IO​::Dir.new(path=>'a', os-error=>'b').fail }; my
@​a = foo(); 1;
camelia​: rakudo b2072f​: ( no output )
labster​: r​: sub foo { X​::IO​::Dir.new(path=>'a', os-error=>'b').fail }; my
@​a := foo(); 1;
camelia​: rakudo b2072f​: OUTPUT«Failed to get the directory contents of 'a'​:
b␤ in method sink at src/gen/CORE.setting​:10169␤ in method BUILDALL at
src/gen/CORE.setting​:801␤ in method bless at src/gen/CORE.setting​:743␤ in
method new at src/gen/CORE.setting​:728␤ in method new at src/gen/CORE.…
labster​: r​: sub foo { X​::IO​::Dir.new(path=>'a', os-error=>'b').fail }; my
$a := foo(); 1;
camelia​: rakudo b2072f​: ( no output )

Unless someone tells me this is not a bug -- but it seems like this would
be the correct approach when loading a lazy list.

@p6rt
Copy link
Author

p6rt commented Jan 2, 2015

From @usev6

AFAIU this looks fine now​:

$ perl6 -e 'sub foo { X​::IO​::Dir.new(path=>"a", os-error=>"b").fail }; my @​a := foo(); 1'
Type check failed in binding; expected 'Positional' but got 'Failure'
  in any bind_error at src/vm/moar/Perl6/Ops.nqp​:224
  in block <unit> at -e​:1

The Failure X​::IO​::Dir is no longer thrown, but the code dies because @​a cannot be bound to a non Positional.

If I add a second element on the rhs of the binding, the code runs fine​:

$ ./perl6 -e 'sub foo { X​::IO​::Dir.new(path=>"a", os-error=>"b").fail }; my @​a := foo(), 42; say @​a.perl'
(Failure.new(exception => X​::IO​::Dir.new(path => "a", os-error => "b")), 42)

I'd vote for 'closable with tests'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jan 2, 2015

From @usev6

AFAIU this looks fine now​:

$ perl6 -e 'sub foo { X​::IO​::Dir.new(path=>"a", os-error=>"b").fail }; my @​a := foo(); 1'
Type check failed in binding; expected 'Positional' but got 'Failure'
  in any bind_error at src/vm/moar/Perl6/Ops.nqp​:224
  in block <unit> at -e​:1

The Failure X​::IO​::Dir is no longer thrown, but the code dies because @​a cannot be bound to a non Positional.

If I add a second element on the rhs of the binding, the code runs fine​:

$ ./perl6 -e 'sub foo { X​::IO​::Dir.new(path=>"a", os-error=>"b").fail }; my @​a := foo(), 42; say @​a.perl'
(Failure.new(exception => X​::IO​::Dir.new(path => "a", os-error => "b")), 42)

I'd vote for 'closable with tests'.

@p6rt
Copy link
Author

p6rt commented Jan 2, 2015

@usev6 - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

From @zoffixznet

Tests​: Raku/roast@5cd8dff2292c1c4cab83f0b5

@p6rt p6rt closed this as completed Dec 12, 2017
@p6rt
Copy link
Author

p6rt commented Dec 12, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant