From: Nicolas C. <nca...@mo...> - 2006-03-06 21:22:33
|
Richard Jones wrote: > On Mon, Mar 06, 2006 at 09:55:36PM +0100, Bardur Arantsson wrote: > >>Richard Jones wrote: >> >>>Currently, String.nsplit "" _ returns a single element list: >>> >>>$ ocaml -I +extlib >>> Objective Caml version 3.08.3 >>> >>># #load "unix.cma";; >>># #load "extLib.cma";; >>># open ExtString;; >>># String.nsplit "" ",";; >>>- : string list = [""] >>># String.nsplit "execute" ",";; >>>- : string list = ["execute"] >>> >>>I would argue, however, that it'd be much better if it acted like >>>Perl's split and this was special-cased to return a zero-length list: >>> >> >>I agree. It probably more useful in general. > > > Anyone else have any opinion on this? I would really like to change > the current implementation. > > Rich. In general I would say it's not very good idea to change some behavior in an incompatible way. But in that case I can't see any example relying on split "" = [""] and not [] so it's ok for me. Nicolas |