Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

$scalar->reverse should reverse the scalar #182

Closed
schwern opened this Issue Feb 24, 2011 · 4 comments

Comments

Projects
None yet
2 participants
Contributor

schwern commented Feb 24, 2011

$scalar->reverse works like reverse($scalar) in that in scalar context it reverses the contents of $scalar and in list context it reverses the list ($scalar) which is to say it does nothing.

$scalar->reverse should always reverse the contents of $scalar regardless of context.

my $scalar = "foo";
my($reverse) = $scalar->reverse;  # list context
is $reverse, "oof";
is scalar $scalar->reverse, "oof";
Contributor

schwern commented Feb 24, 2011

Technically speaking this is an incompatible feature change and should wait for 3.0, but nobody will be doing $scalar->reverse because it currently does nothing useful. I'm find with doing it in 2.x

doherty added a commit to doherty/autobox-Core that referenced this issue Apr 23, 2011

Make $scalar->reverse always reverse $scalar, regardless of context
In list context, this previously reversed the list ($scalar), thus
doing nothing. Now, this will actually reverse the contents of
the scalar.

Fixes evalEmpire/perl5i#182

daxim added a commit to scrottie/autobox-Core that referenced this issue Apr 23, 2011

Make $scalar->reverse always reverse $scalar, regardless of context
In list context, this previously reversed the list ($scalar), thus
doing nothing. Now, this will actually reverse the contents of
the scalar.

Fixes evalEmpire/perl5i#182
Contributor

schwern commented Apr 28, 2011

I guess once the new autobox::Core is out we can depend on that and close this.

Contributor

doherty commented Jun 5, 2011

@daxim: That patch was included in a release to the CPAN at some point, right?

schwern added a commit that referenced this issue Sep 25, 2011

Contributor

schwern commented Sep 25, 2011

Not waiting for an autobox::Core release. Just did it.

@schwern schwern closed this Sep 25, 2011

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