logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Re: String.nsplit empty string: msg#00003

Subject: Re: Re: String.nsplit empty string
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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>