From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 85440D169 for ; Sun, 24 Jul 2005 23:37:57 +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 j6OLbuK1024347 for ; Sun, 24 Jul 2005 23:37:57 +0200 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 XAA10913 for ; Sun, 24 Jul 2005 23:37:56 +0200 (MET DST) Received: from mail25.sea5.speakeasy.net (mail25.sea5.speakeasy.net [69.17.117.27]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j6OLbqxM001109 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 24 Jul 2005 23:37:55 +0200 Received: (qmail 8524 invoked from network); 24 Jul 2005 21:37:47 -0000 Received: from shell1.sea5.speakeasy.net ([69.17.116.2]) (envelope-sender ) by mail25.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 24 Jul 2005 21:37:47 -0000 Date: Sun, 24 Jul 2005 14:37:47 -0700 (PDT) From: brogoff X-X-Sender: brogoff@shell1.sea5.speakeasy.net To: Alex Baretta Cc: caml-list@inria.fr Subject: Re: [Caml-list] "Just say no!" campaign against Obj [was: How to do this properly with OCaml?] In-Reply-To: <42E342FE.6060408@barettadeit.com> Message-ID: References: <42E2393B.5030209@inria.fr> <42E342FE.6060408@barettadeit.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 42E40A35.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42E40A30.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 baretta:01 recursion:01 ligth:01 recursion:01 variants:01 polymorphism:01 okasaki's:01 recursive:01 generations:01 marshalling:01 ocaml:01 campaign:98 2005,:98 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=PLING_QUERY autolearn=disabled version=3.0.3 On Sun, 24 Jul 2005, Alex Baretta wrote: > Once upon a time I felt a desperate need for polymorphic recursion. At > that time the INRIA gang was selling a new ligth drug whose effects are > similar to polymorphic recursion. They called it "polymorphic records". > Polymorphic records do not give addiction--unlike polymorphic variants, > which are much more dangerous from this point of view--but when they are > used to attain that euphoric state of mind given by polymorphic > recursion, they must be injected in one's code with Obj.magic. Yes, i > picked up the syringe and used it. Yes, I got ill with type-unsafety, > but eventually careful medication made me recover. At the end, I must > say experiencing polymorphic recursion was well worth the pain that came > from using Obj.magic. 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? Recursive modules provide a nicer approach, IMO, and explicit types even nicer. > Notwithstanding my experience, I agree with Xavier that is the social > duty of us all to discourage the young generations to take Obj as a > means to escape the conventional type system imposed upon them by > society. 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. 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. -- Brian