From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 9807FBB81 for ; Fri, 24 Feb 2006 14:29:54 +0100 (CET) Received: from grassmarket.ucs.ed.ac.uk (grassmarket.ucs.ed.ac.uk [129.215.166.64]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k1ODTsDZ010115 for ; Fri, 24 Feb 2006 14:29:54 +0100 Received: from smtp.sms.ed.ac.uk (nougat.ucs.ed.ac.uk [192.168.30.2]) by grassmarket.ucs.ed.ac.uk (8.12.10/8.12.10) with ESMTP id k1ODTo3S021106; Fri, 24 Feb 2006 13:29:50 GMT Received: from 80-192-1-11.cable.ubr03.edin.blueyonder.co.uk (80-192-1-11.cable.ubr03.edin.blueyonder.co.uk [80.192.1.11]) by www.sms.ed.ac.uk (Horde MIME library) with HTTP; Fri, 24 Feb 2006 13:29:50 +0000 Message-ID: <20060224132950.7l49sm2akg0sskkw@www.sms.ed.ac.uk> Date: Fri, 24 Feb 2006 13:29:50 +0000 From: EEK Cooper To: Jean-Christophe Filliatre Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Map.fold behavior changed References: <20060224112209.51szurk2dc00oggg@www.sms.ed.ac.uk> <17406.61821.450737.625981@gargle.gargle.HOWL> In-Reply-To: <17406.61821.450737.625981@gargle.gargle.HOWL> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.4) X-Edinburgh-Scanned: at grassmarket.ucs.ed.ac.uk with MIMEDefang 2.33, Sophie, Sophos Anti-Virus X-Scanned-By: MIMEDefang 2.33 (www . roaringpenguin . com / mimedefang) X-Miltered: at concorde with ID 43FF0A52.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 compiler:01 ocaml:01 quoting:01 filliatre:01 filliatr:01 lri:01 ocaml:01 bug:01 unspecified:01 unspecified:01 mli:01 val:01 computes:01 bindings:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=FROM_ENDS_IN_NUMS autolearn=disabled version=3.0.3 I'm glad to hear that others are facing this problem as well. Those of you who are: how are you dealing with it? Are you simply requiring your users to use a particular version of the compiler? Or switching on Sys.ocaml_version? Quoting Jean-Christophe Filliatre : > EEK Cooper writes: > > > My team just noticed that the behavior of Map.fold changed in OCaml > > version 3.08.4. > > > > I'm concerned that the OCaml team would change the behavior of a > > library function so late in its life. I understand that it was thought > > to be "wrong" , but > > changing the behavior of an existing function breaks existing apps and > > shouldn't be done lightly. > > I must agree with you since we also got a similar bug in one of our > apps due to this Map.fold _implementation_ change. > > However, we must also admit that we were using an unspecified feature > of the standard library. If I remember correctly, the documentation > was saying that the traversal order was left _unspecified_. For the record, I don't think this is true. My copy of map.mli, as part of OCaml 3.08.3, says: val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b (** [fold f m a] computes [(f kN dN ... (f k1 d1 a)...)], where [k1 ... kN] are the keys of all bindings in [m] (in increasing order), and [d1 ... dN] are the associated data. *) specifying the same ordering as the current version. Also the original bug ticket about the issue asserts that it should behave according to the documentation. Since the behavior was NOT unspecified, it was reasonable to assume that the documentation suffered from a simple typo, and to expect the behavior not to change. I believe the documentation should have been fixed rather than the behavior. Ezra