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

.trans method modifies its argument #315

Closed
p6rt opened this issue Sep 22, 2008 · 6 comments
Closed

.trans method modifies its argument #315

p6rt opened this issue Sep 22, 2008 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 22, 2008

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

Searchable as RT59204$

@p6rt
Copy link
Author

p6rt commented Sep 22, 2008

From @pmichaud

The .trans method appears to be modifying its argument​:

$ cat x
my $x = [1,2,3] => ['a', 'b', 'c'];

say $x.perl;
say 123.trans($x);
say $x.perl;

$ ./parrot perl6.pbc x
([1, 2, 3] => ["a", "b", "c"])
abc
([] => [])
$

Pm

@p6rt
Copy link
Author

p6rt commented Sep 22, 2008

From @cjfields

On Mon Sep 22 09​:11​:37 2008, pmichaud wrote​:

The .trans method appears to be modifying its argument​:

$ cat x
my $x = [1,2,3] => ['a', 'b', 'c'];

say $x.perl;
say 123.trans($x);
say $x.perl;

$ ./parrot perl6.pbc x
([1, 2, 3] => ["a", "b", "c"])
abc
([] => [])
$

Pm

@p6rt
Copy link
Author

p6rt commented Sep 22, 2008

From @cjfields

trans.patch
Index: languages/perl6/src/builtins/any-str.pir
===================================================================
--- languages/perl6/src/builtins/any-str.pir	(revision 31336)
+++ languages/perl6/src/builtins/any-str.pir	(working copy)
@@ -300,11 +300,12 @@
 
 .sub '!transtable' :multi(_)
     .param pmc r
-    .local pmc retval
+    .local pmc retval, tmps
     retval = new 'ResizableStringArray'
+    tmps = clone r
   range_loop:
-    unless r, done
-    $S0 = r.'shift'()
+    unless tmps, done
+    $S0 = tmps.'shift'()
     push retval, $S0
     goto range_loop
   done:

@p6rt
Copy link
Author

p6rt commented Sep 22, 2008

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

@p6rt
Copy link
Author

p6rt commented Sep 22, 2008

From @pmichaud

Applied in r31339, thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Sep 22, 2008

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

@p6rt p6rt closed this as completed Sep 22, 2008
@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