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

Re: Split with negative limits, and other weirdnesses

From:
David Green
Date:
September 23, 2008 15:04
Subject:
Re: Split with negative limits, and other weirdnesses
Message ID:
FAC6D96A-D705-4E3F-AAE5-AD348602608B@telus.net
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.



-David




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About