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

X*= doesn't modify the original array in Rakudo #2136

Closed
p6rt opened this issue Sep 3, 2010 · 6 comments
Closed

X*= doesn't modify the original array in Rakudo #2136

p6rt opened this issue Sep 3, 2010 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 3, 2010

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

Searchable as RT77660$

@p6rt
Copy link
Author

p6rt commented Sep 3, 2010

From @masak

<Util> rakudo​: my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a = @​a X* 5;
say @​a.perl;
<p6eval> rakudo 33e94e​: OUTPUT«[1, 2, 3]␤[5, 10, 15]␤»
<Util> Should X*= have worked? If not, how to best scale a vector
without repeating the vector's array name?
<masak> @​b = @​a X* 5
<masak> :P
<masak> and yes, I think X*= should have worked.
* masak submits rakudobug
<tylercurtis> rakudo​: my @​a = 1, 2, 3; @​a [X*]= 5; say @​a.perl; @​a =
@​a X* 5; say @​a.perl;
<p6eval> rakudo 33e94e​: OUTPUT«===SORRY!===␤Confused at line 22, near
"@​a [X*]= 5"␤»
<Util> S03 discusses X[+=] vs [X+]= in "Nesting of metaoperators", but
X[*=] does the same as X*= , and [X*]= fails.
<Util> Oh, as tylercurtis just showed.

@p6rt
Copy link
Author

p6rt commented Oct 10, 2011

From @coke

On Thu Sep 02 20​:55​:52 2010, masak wrote​:

<Util> rakudo​: my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a = @​a X* 5;
say @​a.perl;
<p6eval> rakudo 33e94e​: OUTPUT«[1, 2, 3]␤[5, 10, 15]␤»
<Util> Should X*= have worked? If not, how to best scale a vector
without repeating the vector's array name?
<masak> @​b = @​a X* 5
<masak> :P
<masak> and yes, I think X*= should have worked.
* masak submits rakudobug
<tylercurtis> rakudo​: my @​a = 1, 2, 3; @​a [X*]= 5; say @​a.perl; @​a =
@​a X* 5; say @​a.perl;
<p6eval> rakudo 33e94e​: OUTPUT«===SORRY!===␤Confused at line 22, near
"@​a [X*]= 5"␤»
<Util> S03 discusses X[+=] vs [X+]= in "Nesting of metaoperators", but
X[*=] does the same as X*= , and [X*]= fails.
<Util> Oh, as tylercurtis just showed.

This now fails outright​:

19​:25 < [Coke]> rakudo​: my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a = @​a X*
  5;say @​a.perl;
19​:25 <+p6eval> rakudo 38907e​: OUTPUT«Array.new(1, 2, 3)␤splice() not
  implemented in class 'Mu'␤ in method reify at
  src/gen/CORE.setting​:3657␤ in method gimme at
  src/gen/CORE.setting​:4015␤ in method eager at
  src/gen/CORE.setting​:3991␤ in method STORE at
  src/gen/CORE.setting​:4409␤ in block <anon> a…

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 10, 2011

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

@p6rt
Copy link
Author

p6rt commented Oct 21, 2012

From @coke

On Mon Oct 10 16​:25​:45 2011, coke wrote​:

On Thu Sep 02 20​:55​:52 2010, masak wrote​:

<Util> rakudo​: my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a = @​a X* 5;
say @​a.perl;
<p6eval> rakudo 33e94e​: OUTPUT«[1, 2, 3]␤[5, 10, 15]␤»
<Util> Should X*= have worked? If not, how to best scale a vector
without repeating the vector's array name?
<masak> @​b = @​a X* 5
<masak> :P
<masak> and yes, I think X*= should have worked.
* masak submits rakudobug
<tylercurtis> rakudo​: my @​a = 1, 2, 3; @​a [X*]= 5; say @​a.perl; @​a =
@​a X* 5; say @​a.perl;
<p6eval> rakudo 33e94e​: OUTPUT«===SORRY!===␤Confused at line 22, near
"@​a [X*]= 5"␤»
<Util> S03 discusses X[+=] vs [X+]= in "Nesting of metaoperators", but
X[*=] does the same as X*= , and [X*]= fails.
<Util> Oh, as tylercurtis just showed.

This now fails outright​:

19​:25 < [Coke]> rakudo​: my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a = @​a X*
5;say @​a.perl;
19​:25 <+p6eval> rakudo 38907e​: OUTPUT«Array.new(1, 2, 3)␤splice() not
implemented in class 'Mu'␤ in method reify at
src/gen/CORE.setting​:3657␤ in method gimme at
src/gen/CORE.setting​:4015␤ in method eager at
src/gen/CORE.setting​:3991␤ in method STORE at
src/gen/CORE.setting​:4409␤ in block <anon> a…

Output is now close to the OP​:

my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a = @​a X* 5;say @​a.perl;
Array.new(1, 2, 3)
Array.new(5, 10, 15)

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Apr 16, 2014

From @Mouq

On Sun Oct 21 06​:35​:20 2012, coke wrote​:

On Mon Oct 10 16​:25​:45 2011, coke wrote​:

On Thu Sep 02 20​:55​:52 2010, masak wrote​:

<Util> rakudo​: my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a = @​a X*
5;
say @​a.perl;
<p6eval> rakudo 33e94e​: OUTPUT«[1, 2, 3]␤[5, 10, 15]␤»
<Util> Should X*= have worked? If not, how to best scale a vector
without repeating the vector's array name?
<masak> @​b = @​a X* 5
<masak> :P
<masak> and yes, I think X*= should have worked.
* masak submits rakudobug
<tylercurtis> rakudo​: my @​a = 1, 2, 3; @​a [X*]= 5; say @​a.perl; @​a

@​a X* 5; say @​a.perl;
<p6eval> rakudo 33e94e​: OUTPUT«===SORRY!===␤Confused at line 22,
near
"@​a [X*]= 5"␤»
<Util> S03 discusses X[+=] vs [X+]= in "Nesting of metaoperators",
but
X[*=] does the same as X*= , and [X*]= fails.
<Util> Oh, as tylercurtis just showed.

This now fails outright​:

19​:25 < [Coke]> rakudo​: my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a =
@​a X*
5;say @​a.perl;
19​:25 <+p6eval> rakudo 38907e​: OUTPUT«Array.new(1, 2, 3)␤splice() not
implemented in class 'Mu'␤ in method reify at
src/gen/CORE.setting​:3657␤ in method gimme at
src/gen/CORE.setting​:4015␤ in method eager at
src/gen/CORE.setting​:3991␤ in method STORE at
src/gen/CORE.setting​:4409␤ in block <anon> a…

Output is now close to the OP​:

my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a = @​a X* 5;say @​a.perl;
Array.new(1, 2, 3)
Array.new(5, 10, 15)

Looks fixed​:

perl6 -e'my @​a = 1, 2, 3; @​a X*= 5; say @​a.perl; @​a = @​a X* 5; say @​a.perl;'
Array.new(5, 10, 15)
Array.new(25, 50, 75)

As well, S03-metaops/cross.t has a test making sure that X*= modifies the container, so I'm marking this as resolved

@p6rt p6rt closed this as completed Apr 16, 2014
@p6rt
Copy link
Author

p6rt commented Apr 16, 2014

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

@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