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 nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 3D713D16D for ; Mon, 25 Jul 2005 10:16:26 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6P8GPKt017807 for ; Mon, 25 Jul 2005 10:16:25 +0200 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 KAA17276 for ; Mon, 25 Jul 2005 10:16:25 +0200 (MET DST) Received: from alex.barettalocal.com (h213-255-109-130.albacom.net [213.255.109.130] (may be forged)) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j6P8GOKD017804 for ; Mon, 25 Jul 2005 10:16:24 +0200 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by alex.barettalocal.com (Postfix) with ESMTP id BD6962BAB90; Mon, 25 Jul 2005 10:15:21 +0200 (CEST) Message-ID: <42E49F99.4030204@barettadeit.com> Date: Mon, 25 Jul 2005 10:15:21 +0200 From: Alex Baretta User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) X-Accept-Language: en-us, en MIME-Version: 1.0 To: brogoff Cc: caml-list@inria.fr Subject: Re: [Caml-list] "Just say no!" campaign against Obj [was: How to do this properly with OCaml?] References: <42E2393B.5030209@inria.fr> <42E342FE.6060408@barettadeit.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 42E49FD9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 42E49FD8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; baretta:01 caml-list:01 ocaml:01 polymorphism:01 recursion:01 okasaki's:01 recursion:01 recursive:01 recursive:01 iirc:01 marshalling:01 segfault:01 ocaml:01 caml-list:01 beginner's: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.9 required=5.0 tests=FORGED_RCVD_HELO,PLING_QUERY autolearn=disabled version=3.0.3 brogoff wrote: > > I was able to use the higher order polymorphism of record fields to implement > polymorphic recursion, WITHOUT using Obj.magic. I posted that approach on the > list a long time ago, it was really the same trick as using polymorphic methods > to do the same. You can use that trick to implement the signatures in Okasaki's > book that use P.R. fairly easily. Why did you need Obj.magic? I guess the reason is that I could not think of anything better. My implementation of transaction calculus requiring polymorphic recursion is of october 2003. I kind of remember a post from you on this issue, but it must have appeared later. > Recursive modules provide a nicer approach, IMO, and explicit types even nicer. I'm not sure recursive modules had been released at that time. 3.06 it was, IIRC; whereas, recursive modules appeared in 3.07, right? > My issues with the type system are rarely (if ever) made better by using > Obj.magic. GCaml and Alice (with it's packages) tackle the main issue, > which is type safe marshalling. We have two instances of Obj.magic and and about as many instances of Marshal.from_xxx. Not once have we escaped the segfault awaiting behind the bend... > I agree that a more expressive type system would be nice, and I used Obj > too to get a set_cdr thing going (like in ExtLib) but if you need efficiency > that badly then I think it makes more sense to use C and extend OCaml that > way. Actually, it is never for efficiency. The type-unsafeties are either due to marshalling--there's little we can do about it at present--to polymorphic recursion--I'll look at your proposal based on recursive modules--or the classic set_cdr thing in a heapsort implementation on lists. Alex > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) The FreerP Project