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 PAA31139; Mon, 2 Apr 2001 15:32:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA31137 for ; Mon, 2 Apr 2001 15:32:47 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f32DWij29085; Mon, 2 Apr 2001 15:32:44 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA31114; Mon, 2 Apr 2001 15:32:44 +0200 (MET DST) Date: Mon, 2 Apr 2001 15:32:44 +0200 From: Xavier Leroy To: Brian Rogoff Cc: caml-list@inria.fr Subject: Re: [Caml-list] petty complaints Message-ID: <20010402153244.D30450@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from bpr@best.com on Sun, Apr 01, 2001 at 09:26:59PM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > In response to the recent query about string libraries I took my own > advice and ported the Mosml substring library to OCaml. This exercise > raised a question which I've had before but never seen asked or answered, > namely, why doesn't OCaml use something like SML's order datatype > GREATER | EQUAL | LESS for comparison rather than an integer? It seems > against the spirit of static typing. What's the rationale? Efficiency? > Hysterical raisins? Mostly hysterical :-) A long time ago, I thought that fun x y -> x - y was a suitable comparison function for integers. Of course, it's not because of overflow in subtraction, and one really needs to pay the price for two comparisons. So, from an efficiency standpoint, there would really be no difference between the current OCaml approach and the SML "order" datatype. > Another unrelated trifling question concerns the syntax of numerical > literals. Would it be possible to allow a la Ada the insertion of _s in > a numerical literal so instead of 1000000,10000000,and 100000000 we could > write 1_000_000, 10_000_000, 100_000_000? Of course, as in Ada, you could > allow wrongly positioned or superfluous _s (1_00_00_______0) but I think > this trivial change can make reading numbers a bit nicer. That's amusing, I didn't know about this feature of Ada. For integers, this would be trivial to implement; a bit more work for floats, because we rely on the C library atof() function, which doesn't know about the underscores. What do other think? - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr