emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: split-string behavior change


From: Drew Adams
Subject: RE: split-string behavior change
Date: Sun, 24 Feb 2008 18:26:30 -0800

>  > I'm not suggesting we change anything now, but I'm curious 
>  > about the change in behavior of split-string from Emacs 21 to 22.
> 
> split-string in Emacs 21 was unable to give appropriate results for
> 
>     (split-string csv ",")
> 
> where CSV is in comma-separated values format, and has leading or
> trailing empty fields.  That turns out to be a moderately big deal,
> because it is non-trivial to code this function efficiently and
> correctly.  (At least, that was the motivation I was told for XEmacs
> not removing nulls at all.  Apparently how to parse CSV correctly was
> a FAQ in some circles.)  Also, for several cases it gave different
> results from XEmacs (including this case).
> 
> The current behavior is the result of a compromise which preserves the
> magic behavior of removing empty fields in the one-argument case, uses
> the simpler behavior of just splitting on the regexp always in the
> two-argument case, and restores magic behavior in the three argument
> case with a non-nil third argument.

Thanks for the summary. 

I was questioning only the polarity of the optional third arg - why a nil
value wasn't used to give you the same behavior for two args in Emacs 20,
21, and 22. I understand now that using non-nil was a negotiated compromise.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]