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 AAA11062; Wed, 23 Jul 2003 00:35:48 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 AAA00513 for ; Wed, 23 Jul 2003 00:35:46 +0200 (MET DST) Received: from epexch01.qlogic.org ([63.170.40.3]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h6MMZjT02946 for ; Wed, 23 Jul 2003 00:35:45 +0200 (MET DST) Received: from epmailtmp.qlogic.org ([10.20.33.254]) by epexch01.qlogic.org with Microsoft SMTPSVC(5.0.2195.5329); Tue, 22 Jul 2003 17:33:56 -0500 Received: from [10.20.33.146] ([10.20.33.146]) by epmailtmp.qlogic.org with Microsoft SMTPSVC(5.0.2195.4905); Tue, 22 Jul 2003 17:34:49 -0500 Date: Tue, 22 Jul 2003 17:34:44 -0500 (CDT) From: Brian Hurt X-X-Sender: Reply-To: Brian Hurt To: Jacques Garrigue cc: Ocaml Mailing List Subject: Re: [Caml-list] Variant parameterized method? In-Reply-To: <20030723070614J.garrigue@kurims.kyoto-u.ac.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 22 Jul 2003 22:34:49.0556 (UTC) FILETIME=[75F6A140:01C350A1] X-Loop: caml-list@inria.fr X-Spam: no; 0.00; qlogic:01 caml-list:01 jacques:01 foo:01 bug:01 behave:01 subtypes:01 instanceof:01 ocaml:01 caml:01 garrigue:01 simpler:01 variant:02 arbitrary:02 explicit:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Thanks for your help. On Wed, 23 Jul 2003, Jacques Garrigue wrote: > This precise type is not admissible in the ocaml type system. > In ocaml recursive types must be regular: only 'a foo may occur in the > expansion of 'a foo. Ah. Any hope of getting this fixed? > > This problem is discussed in an answer to PR#1730 in the caml bug > database. Unfortunately, I don't speak french. > This can be solved by introducing an explicit wrapper. This is one possibility. > If you think (as I do) that all these examples are just too > complicated in practice, there is a simpler way to go: > only define a fold method in your class, and define map itself out of > the class. Maybe I'm asking the wrong question. I need/want map to behave differently when called on different subtypes of foo. In a pseudo java/ocaml mix, I want to do: let map f x = if x instanceof 'a foo_map then let e = ('a foo_map) in (* various code dealing with an already mapped foo *) else (* various code dealing with an arbitrary unmapped foo *) The obvious way to do this to me is to make map a member function. But this wouldn't be the first time I was missing something obvious. Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners