develooper Front page | perl.perl6.language | Postings from September 2008

Re: Split with negative limits, and other weirdnesses

Thread Previous
David Green
September 23, 2008 15:04
Re: Split with negative limits, and other weirdnesses
Message ID:
On 2008-Sep-23, at 8:38 am, TSa wrote:
> Moritz Lenz wrote:
>> In Perl 5 a negative limit means "unlimited", which we don't have  
>> to do
>> because we have the Whatever star.
> I like the notion of negative numbers as the other end of infinity.

I think positive values and zero make sense.  But I don't want to give  
funny meanings to negatives; it would be better to replace the int  
limit with a range instead.  (Maybe it would be OK to accept a single  
Int as short for 1..$i, or *-$i as short for *-$i..*.)

Then again, we could get rid of the limit arg altogether, return  
everything, and take a slice of the result -- assuming it can be lazy  
enough to calculate only what ends up getting sliced out.


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About