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 QAA27444; Tue, 24 Jun 2003 16:35:24 +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 QAA27378 for ; Tue, 24 Jun 2003 16:35:23 +0200 (MET DST) Received: from cgpsrv1.cis.mcmaster.ca (muss.CIS.McMaster.CA [130.113.64.9]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h5OEZMf00985 for ; Tue, 24 Jun 2003 16:35:22 +0200 (MET DST) Received: from [137.122.39.201] (account ) by cgpsrv1.cis.mcmaster.ca (CommuniGate Pro WebUser 3.5.9) with HTTP id 44933666; Tue, 24 Jun 2003 10:34:44 -0400 From: "Jacques Carette" Subject: Re: [Caml-list] First order compile time functorial polymorphism in Ocaml To: Jacques Carette Cc: caml-list@inria.fr X-Mailer: CommuniGate Pro Web Mailer v.3.5.9 Date: Tue, 24 Jun 2003 10:34:44 -0400 Message-ID: In-Reply-To: <3EF847E2.1010501@ozemail.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format="flowed" Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; jacques:01 caml-list:01 functorial:01 ozemail:01 reuse:01 generic:01 criticism:01 partition:01 hardin:01 functors:01 ocaml:01 variants:01 polymorphic:01 routines:02 variant:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk John Max Skaller wrote: > Jacques Carette wrote: > Curious: how useful? How many times did you reuse it? I've used generic_traverse in a dozen places, and will likely use it more often. > Its a hack yes, looks ugly :( Oh, fully agreed! The point of posting it was to get some constructive criticism in the hopes of being able to do better. > Perhaps can do better with polymorphic variants. My first prototype (which got wiped out in some disk crash) did use polymorphic variants. I decide to not use them again to see if I really needed them. And perhaps I do. > Ugly separating the filter > for the special actions from those actions: Very much so, but I found the combined filter/action routines even harder to read, with more code duplication than I could swallow!! So I used this 2-stage approach. > Uggh. Like to be writing something like > | `Mlist args -> .. > | `Mseq args -> .. > | _ -> .. I will re-explore this. > or perhaps > | #usual_case -> > instead of the last line if there happens to be > a type partition matching the requirements. I read about #types in the Ocaml manual. Are you referring to using classes or the (documented obsolete) expansion of variant types ? Even though S. Boulmé, Th. Hardin, and R. Rioboo in "Polymorphic Data Types, Objects, Modules and Functors: is it too much ?" (see http://www.lip6.fr/reports/lip6.2000.014.html) argue quite cogently about the use of the full power of Ocaml for doing mathematics [my real goal], I was hoping that for writing a language interpreter I did not need to go that far. Jacques ------------------- 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