From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 76DB9BC75 for ; Fri, 25 Feb 2005 00:58:01 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j1ONvods000770 for ; Fri, 25 Feb 2005 00:58:00 +0100 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 AAA28334 for ; Fri, 25 Feb 2005 00:57:50 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j1ONvljv032165 for ; Fri, 25 Feb 2005 00:57:49 +0100 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id j1ONvhuC021438; Fri, 25 Feb 2005 08:57:44 +0900 (JST) Date: Fri, 25 Feb 2005 08:57:39 +0900 (JST) Message-Id: <20050225.085739.92345506.garrigue@math.nagoya-u.ac.jp> To: cstork@ics.uci.edu Cc: caml-list@inria.fr Subject: Re: [Caml-list] Unquantifiable escaping type in variation of visitor pattern From: Jacques Garrigue In-Reply-To: <20050224121635.GA22511@anthony.ics.uci.edu> References: <20050222172907.GA8376@anthony.ics.uci.edu> <20050223.120815.41202930.garrigue@math.nagoya-u.ac.jp> <20050224121635.GA22511@anthony.ics.uci.edu> X-Mailer: Mew version 4.1.53 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 421E69FB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 escaping:01 mutable:01 grammars:01 rec:01 right-hand:01 rec':01 lazy:01 subtyping:01 subtyping:01 subtype:01 nodes:01 verbose:01 ocaml:01 bug:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: From: Christian Stork > It's not that I didn't try otherwise. These are the reasons (I attached > illustrative code): > > - The mutable parts/alts/item fields in aggrRule/choiceRule/listRule > seem necessary since I cannot define grammars (ie recursively defined > objects). Object instantiation is not allowed to the right of a let > rec! > > "This kind of expression is not allowed as right-hand side of `let rec'" The alternative is to use "lazy", which has the extra advantage of being covariant. > (Does that mean that 3.08.3 will be released soon?) There was supposed to be a "Valentine day release", but clearly it didn't happen. > > But in your particular example there is no subtyping at all, so there > > should be no problem anyway. > > I don't know which particular subtyping you refer to, but, of course, I > intend to subtype the rules and visitors. Well, as long as you use refs in your definitions, subtyping is impossible on nodes. You may of course subclass rules, but then you won't need to use explicit subtyping either, since it is already done in your make*Node methods through a self-coercion. So the specific problem I was writing about should not happen. > > I attach the modified part of your example, which uses a few tricks to > > make the code much less verbose. > > Hmm, are these tricks documentd anywhere? I didn't even see the option > to use constraints in regular variant types in the official OCaml > manual. Anyway, thanks a lot for the improvements. They are in the reference part of the manual. In the tutorial, they only appear for objects, which is what they were originally introduced for. Somehow it's fortunate that these tricks are not well publicized, since they trigger a bug. On the other hand the bug could have been corrected earlier... Jacques Garrigue