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

Strange behavior when doing ||= assignment to an 'is copy' array parameter #2337

Closed
p6rt opened this issue Jan 26, 2011 · 5 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Jan 26, 2011

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

Searchable as RT82810$

@p6rt
Copy link
Author

p6rt commented Jan 26, 2011

From @masak

<masak> rakudo​: sub foo(@​a is copy) { @​a ||= -1, -1, +1, +1; say @​a };
foo([1,2,3,4]); say "alive"
<p6eval> rakudo 188755​: OUTPUT«alive␤»
* masak submits rakudobug
<masak> jnthn​: I'm expecting &foo to output something.
<jnthn> er, yeah, me too. :/
<jnthn> is it the is copy?
<masak> this feels familiar...
* masak czechs
<masak> I might have been remembering
http://rt.perl.org/rt3/Ticket/Display.html?id=74430
<jnthn> looks related.
<masak> yeah.
<masak> this goes in too, though.
<jnthn> Please add a ref to the other ticket.
<masak> sure thing :)
<jnthn> rakudo​: sub foo(@​a) { say PARROT(@​a) }; sub bar(@​a is copy) {
say PARROT(@​a) }; foo([1,2]); bar([1,2])
<p6eval> rakudo 188755​: OUTPUT«ObjectRef->ObjectRef->Array␤Array␤»
<jnthn> FAIL

@p6rt
Copy link
Author

p6rt commented Jan 15, 2012

From @jnthn

On Tue Jan 25 16​:03​:48 2011, masak wrote​:

<masak> rakudo​: sub foo(@​a is copy) { @​a ||= -1, -1, +1, +1; say @​a };
foo([1,2,3,4]); say "alive"
<p6eval> rakudo 188755​: OUTPUT«alive␤»
* masak submits rakudobug
<masak> jnthn​: I'm expecting &foo to output something.
<jnthn> er, yeah, me too. :/

Works these days​:

sub foo(@​a is copy) { @​a ||= -1, -1, +1, +1; say @​a }; foo([1,2,3,4]);
say "alive"
1 2 3 4
alive

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Jan 15, 2012

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

@p6rt
Copy link
Author

p6rt commented Jan 30, 2012

From @moritz

Now tested in S06-traits/is-copy.t.

@p6rt
Copy link
Author

p6rt commented Jan 30, 2012

@moritz - 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