# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #68112]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=68112 >


<masak> rakudo: say (1..10).sort(&rand)
<jnthn> Yes.
<p6eval> rakudo e02bc0: OUTPUT«too many arguments passed - 0 params
expected␤in sub rand [...]
<masak> shouldn't that work?
<jnthn> rakudo: say &rand.multi
<p6eval> rakudo e02bc0: OUTPUT«0␤»
<jnthn> rakudo: say &rand.signature.perl
<p6eval> rakudo e02bc0: OUTPUT«:(Any *...@args)␤»
<jnthn> rakudo: say &rand.arity
<masak> jnthn: wrong, right?
<p6eval> rakudo e02bc0: OUTPUT«0␤»
<pmichaud> Note that slurpies are supposed to be Object, not Any
<jnthn> masak: Well the answers can't both be right. ;-)
<jnthn> Anyway, rand is 0-ary, at least as far as Rakudo knows it.
<masak> jnthn: right, so &sort should accept it.
<jnthn> So in your sort example, Rakudo doesn't really know what to do
with an 0-ary.
<Tene> *any* 0-ary sub passed to sort is effectively a random sort.
<Tene> so we can optimize that and just return the list in the same
order it was passed. :)
<pmichaud> well, it depends on the 0-ary.
<pmichaud> a 0-ary sub that always returns zero should end up not
modifying the sort
<jnthn> Aye.
<jnthn> True.
<jnthn> It's odd anyway. ;-)
<Tene> is Perl 6's sort guaranteed to be stable?
<masak> Tene: aye.
<jnthn> But maybe sort could be made to understnad 0-ary blocks.
<masak> jnthn: spec says it should.
<jnthn> ah, ok
<jnthn> Then, fix it. :-)
* masak submits rakudobug
<jnthn> Or rakudobug. ;)
<pmichaud> the spec says it supports 0-ary blocks?
<masak> pmichaud: aye.
<pmichaud> weird
<masak> aye.

Reply via email to