From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA15677; Tue, 4 Mar 2003 01:13:49 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA16601 for ; Tue, 4 Mar 2003 01:13:47 +0100 (MET) Received: from marble.he.net (marble.he.net [216.218.230.2]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h240DjH26383 for ; Tue, 4 Mar 2003 01:13:46 +0100 (MET) Received: from ucdavis.edu ([208.227.214.58] (may be forged)) by marble.he.net (8.8.6/8.8.2) with ESMTP id QAA14849 for ; Mon, 3 Mar 2003 16:13:42 -0800 Message-ID: <3E63F13E.4090303@ucdavis.edu> Date: Mon, 03 Mar 2003 16:20:14 -0800 From: Issac Trotts User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020913 Debian/1.1-1 MIME-Version: 1.0 To: OCaml List Subject: Re: [oliver: Re: [Caml-list] Strings as arrays or lists...] References: <20030303182806.GC624@first.in-berlin.de> <20030303210554.GA5245@force.stwing.upenn.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; issac:01 trotts:01 ijtrotts:01 oliver:01 caml-list:01 lovas:01 brogoff:01 bandel:01 agitate:01 extensional:01 notations:01 char:01 module's:01 unification:01 generic:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk William Lovas wrote: >On Mon, Mar 03, 2003 at 12:10:45PM -0800, brogoff@speakeasy.net wrote: > > >>On Mon, 3 Mar 2003, Oliver Bandel wrote: >> >> >>>What I first have written about the string-stuff, >>>was: It's not FP-like, but I also would be happy >>>with a syntax, that would allow me, to use Array-functions >>>for the Strings. >>> >>> >>That's why I said "Agitate for extensional polyorphism!". You really want a >>way to overload similar notations. As you must now know, OCaml has no >>overloading. Extensional polymorphism gives you that overloading, on top of >>ML, in a way that even people who hate overloading should find fairly >>nonthreatening. >> >> > >You keep skirting around this question by saying that what he really wants >is extensional polymorphism, but overloading is not the only way to get the >same syntax for strings and arrays. Another way is to have them simply *be >the same thing*. That is, is there any deep reason not to do > > type string = char array > >right up front, and inherit all the Array module's functions? We could >still keep a String library with all string-specific functions in it, but >we'd gain a unification of many function implementations, and the same >notation for random access to boot. > >You mentioned that strings are packed -- meaning that they're more >efficient than generic arrays? But doesn't O'Caml already have compiler >magic for making float arrays fast and efficient? Why not just do the same >thing for char arrays? > Char arrays take up four times as much space as strings, but there is a tradeoff of space versus time. The statement let a = Array.make 2000000 ' ';; takes no noticable time, but let s = String.make 2000000 ' ';; takes about 7 seconds to run on my computer. Issac Trotts > >You indicated towards the end of your email that you feel that strings and >arrays are different enough to warrant different representations, but i'm >not convinced yet. What's the good reason for separating these two ideas >that are clearly very similar in interface, and probably not too different >in implementation? > >William > >------------------- >To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr >Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ >Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > > > ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners