Split with negative limits, and other weirdnesses

2008-09-23 Thread Moritz Lenz
Today a patch to rakudo brought up the question what split() should do if the $limit argument is either zero or negative. In Perl 5 a negative limit means "unlimited", which we don't have to do because we have the Whatever star. A limit of 0 is basically ignored. Here are a few solution I could t

Another split() question - when is there a capture?

2008-09-23 Thread Moritz Lenz
split seems to be a suprisingly tricky beast ;-) To quote S29: : As with Perl 5's split, if there is a capture in the pattern it : is returned in alternation with the split values. Unlike with : Perl 5, multiple such captures are returned in a single Match object. Unlike in Perl 5, it is not det

Re: Split with negative limits, and other weirdnesses

2008-09-23 Thread TSa
HaloO, 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. Where infinity here is the length of the split list which can be infinite if split is called

Re: Subroutine parameter with trait and default.

2008-09-23 Thread John M. Dlugosz
PS Incidentally, it seems silly to have "is rw" but not "is ro". I keep writing "is ro". The synopses says "readonly". But now that it is possible, I nominate changing a hyphen. I'm not opposed to having it be "ro", but wonder why he didn't call it that in the first place, so there mu

Why no "is ro"? (Re: Subroutine parameter with trait and default.)

2008-09-23 Thread Michael G Schwern
John M. Dlugosz wrote: > I'm not opposed to having it be "ro", but wonder why he didn't call it that > in the first place, so there must be a reason. Nobody's perfect? My other thought is that since parameters are read-only by default it's not thought you'd have to write it much so clarity wins o

Re: Why no "is ro"? (Re: Subroutine parameter with trait and default.)

2008-09-23 Thread David Green
On 2008-Sep-23, at 2:32 pm, Michael G Schwern wrote: My other thought is that since parameters are read-only by default it's not thought you'd have to write it much so clarity wins out over brevity, the flip side of Huffamn encoding. But that doesn't work out so good for normal variable de

Re: Split with negative limits, and other weirdnesses

2008-09-23 Thread David Green
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

Re: Why no "is ro"? (Re: Subroutine parameter with trait and default.)

2008-09-23 Thread Michael G Schwern
David Green wrote: > On 2008-Sep-23, at 2:32 pm, Michael G Schwern wrote: >> My other thought is that since parameters are read-only by default >> it's not >> thought you'd have to write it much so clarity wins out over brevity, >> the flip >> side of Huffamn encoding. But that doesn't work out so

Re: Why no "is ro"? (Re: Subroutine parameter with trait and default.)

2008-09-23 Thread John M. Dlugosz
Michael G Schwern schwern-at-pobox.com |Perl 6| wrote: It should be possible to alias it in your own scope easily. Every time someone replies to a Perl 6 language design nit with "but you can change the grammar" *I* kill a kitten. *meowmmmf* That would not be a change in the gramma

Re: Why no "is ro"? (Re: Subroutine parameter with trait and default.)

2008-09-23 Thread John M. Dlugosz
Michael G Schwern schwern-at-pobox.com |Perl 6| wrote: John M. Dlugosz wrote: I'm not opposed to having it be "ro", but wonder why he didn't call it that in the first place, so there must be a reason. Nobody's perfect? My other thought is that since parameters are read-only by default