# New Ticket Created by  Alex Jakimenko 
# Please include the string:  [perl #127424]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=127424 >


Code:
say <a b c d e f g h i j k>.rotor: 1.5

Result:
((a b) (b c) (d e) (e f) (g h) (h i) (j k))


Hmm, I'm not sure if this was intended to work, but:

Code:
say ^11 .rotor: 1.5

Result:
This type cannot unbox to a native integer
  in block <unit> at -e line 1


My biggest problem with this is that it is not consistent.

<perlpilot> AlexDaniel: IMHO, any non-Int values for the number of items to
                        take/skip should be considered an error.  Maybe Inf
could be used
                        for "take the rest" or "skip the rest", but
otherwise non-Int
                        should error.
<AlexDaniel> perlpilot: but it's an interesting feature
<ZoffixW> perlpilot, why error and not just .Int?
<ZoffixW> m: say <a b c d e f g h i j k>[1..1.5], (^10)[1..1.5]
<camelia> rakudo-moar 780192: OUTPUT«(b)(1)␤»
<perlpilot> m: say <a b c d e f g h i j k>.rotor: 2 => -1, 2 => 0;   # Much
much MUCH clearer than  .rotor: 1.5
<camelia> rakudo-moar 780192: OUTPUT«((a b) (b c) (d e) (e f) (g h) (h i)
(j k))␤»
<perlpilot> ZoffixW: because I favor explicit over implicit when there's
the potential for ambiguity.

So, having fractional counts is not required. Either we throw an error (a
meaningful one) or we just .Int it. Whether it should do one or another is
non-obvious, see this discussion:
http://irclog.perlgeek.de/perl6/2016-01-29#i_11960287

Same problem also appears on RHS of a pair:

Code:
say <a b c d e f g h i j k>.rotor: 1 => 0.5

Result:
((a) (b) (d) (e) (g) (h) (j))

But

Code:
say ^10 .rotor: 1 => 0.5

Result:
===SORRY!===
This type cannot unbox to a native integer


This time it is a compile-time error (without a line number!), not run
time. How weird.

Reply via email to