On Thursday 09 December 2004 01:49 pm, Austin Ziegler wrote:
| >> split. This change would break a lot of code silently.
| >
| > Really? In all my code I either had to put the -1 in b/c I was getting
| > unexpected results (wasting many hours, btw!); or it didn't really matter
| > either way --empty strings usually end up in no-effect results.
|
| Really. I just did a quick audit of my publicly released code -- no checks
| to see what would be broken if I add -1 -- but NONE of my code uses split
| with -1, and I have ~45 split calls in said code. Are YOU going to
| volunteer to test all of my code (and everyone else's?) because you don't
| like adding the -1?

Could you send me said code? I would like to see how it effects things. 

Also understand that I never paid _any_ attention until one day my program 
wouldn't work and I could not figure out why. Well, nearly a day of debugging 
later I traced it to a split call and finally learned about the -1. I was not 
amused.

| > Might it break code? Sure. But a lot? I doubt it. In fact I suspect some
| > of those same programs might have edge cases that would break them for
| > the lack of the -1.
|
| *shrug*
|
| My code is written without the -1. If you want this default behaviour
| changed -- that's been in Ruby for quite a while -- then you take on the
| responsibility for testing all of the code out there. 

In the same amount of time I spent working out that first bug, I probably 
could have adjusted the vast majority of programs that would be effected.

| It is not clear that the existing behaviour is broken.

Broken is not the argument. Obviously it is usable. The question is, is it 
well designed?

     If the _limit_ parameter is omitted, trailing null fields are
     suppressed. If _limit_ is a positive number, at most that number of
     fields will be returned (if _limit_ is +1+, the entire string is
     returned as the only entry in an array). If negative, there is no
     limit to the number of fields returned, and trailing null fields
     are not suppressed.

Just reading that is enough to know, but also given that the issue has come up 
a number of independent times, it is quite obvious that it is not well 
designed.

T.