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
.sort doesn't accept &rand (or zero-arg subs in general) in Rakudo #1190
Comments
From @masak<masak> rakudo: say (1..10).sort(&rand) |
From @bbkrOn Kiev build: $ perl6 -e 'say (1..10).sort(&rand)' |
The RT System itself - Status changed from 'new' to 'open' |
From @bbkrtests added in |
@bbkr - Status changed from 'open' to 'resolved' |
From @masakOn Mon Jul 12 08:07:38 2010, bbkr wrote:
I'd argue that this is the wrong behavior. I'd like for it to behave the same way this does:
Oh, and I get a different result with Rakudo 2010.06-219-g7579f7a:
|
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S32-list/sort.t commit 8a55371caf69c520e9c5272fa84b24d6a4f33682 [t/spec] tests for RT #68112 sort doesnt accept &rand (or zero-arg subs in general) Inline Patchdiff --git a/t/spec/S32-list/sort.t b/t/spec/S32-list/sort.t
index 2f82da3..de6f71a 100644
--- a/t/spec/S32-list/sort.t
+++ b/t/spec/S32-list/sort.t
@@ -1,6 +1,6 @@
use v6;
use Test;
-plan 29;
+plan 31;
# L<S32::Containers/"List"/"=item sort">
@@ -210,4 +210,13 @@ plan 29;
'sort by class name';
}
+# RT #68112
+{
+ sub foo () { 0 }
+ lives_ok { (1..10).sort(&foo) },
+ 'sort accepts 0-arity method';
+ lives_ok { (1..10).sort(&rand) },
+ 'sort accepts rand method';
+}
+
# vim: ft=perl6 |
@masak - Status changed from 'resolved' to 'open' |
From @bbkr[17:24] <bbkr> masak: should i revert it from test suite untill expected |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S32-list/sort.t commit dda2c2b53e5d047cff3110138f5982f3e8b2270d [t/spec] tests for RT #68112 sort doesnt accept &rand (or zero-arg subs in general) - fudged Inline Patchdiff --git a/t/spec/S32-list/sort.t b/t/spec/S32-list/sort.t
index de6f71a..1e0d219 100644
--- a/t/spec/S32-list/sort.t
+++ b/t/spec/S32-list/sort.t
@@ -211,6 +211,7 @@ plan 31;
}
# RT #68112
+#?rakudo skip "determine behavior of 0-arity methods passed to sort"
{
sub foo () { 0 }
lives_ok { (1..10).sort(&foo) }, |
From @bbkr[17:42] <masak> bbkr: re "determine behavior of 0-arity methods passed |
From @masakOn Mon Jul 12 08:46:21 2010, bbkr wrote:
Changing my mind on this one. use .pick(*) if you want .sort(&rand) Rejecting ticket. |
@masak - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#68112 (status was 'rejected')
Searchable as RT68112$
The text was updated successfully, but these errors were encountered: