Ok, maybe what it should return would be some sort of ReversedRange object?
I guess this could be considered a feature request, but, I'd like is for (^5).reverse.reverse
and similar to be able to produce a Range.

-----Original Message----- From: Moritz Lenz via RT
Sent: Friday, November 20, 2015 2:45 AM
To: ben-goldb...@hotmail.com
Subject: [perl #126684] [BUG] Reverse on a Range returns a List, not a Range

Hi,

On Thu Nov 19 18:04:14 2015, ben-goldb...@hotmail.com wrote:
perl6 –e ‘(^5).reverse.WHAT.say’
Produces ‘(List)’, when I would have expected it to produce ‘(Range)’
For small Ranges, this might not matter, but for large ones it surely does.

A range with the endpoint smaller than the smarting point is considered to be empty, so if (^5).reverse returned a Range, iterating over that would give an empty list.

Since this is not what folks generally want, return a List (or Seq, maybe) from Range.reverse is actually correct.

Cheers,
Moritz

Reply via email to