From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA22962 for caml-redistribution; Tue, 19 Nov 1996 16:49:25 +0100 (MET) 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 QAA00879 for ; Mon, 18 Nov 1996 16:23:54 +0100 (MET) Received: from lri.lri.fr (root@lri.lri.fr [129.175.15.1]) by nez-perce.inria.fr (8.7.6/8.7.1) with ESMTP id QAA10200 for ; Mon, 18 Nov 1996 16:23:52 +0100 (MET) Received: from newsun8.lri.fr (root@newsun8.lri.fr [129.175.8.15]) by lri.lri.fr (8.8.3/jtpda-5.2) with ESMTP id QAA05364 for ; Mon, 18 Nov 1996 16:23:52 +0100 (MET) Received: from newsun8 by newsun8.lri.fr (8.6.12/local) with SMTP id QAA09499 for ; Mon, 18 Nov 1996 16:23:51 +0100 Message-ID: <32907F85.15BC@lri.fr> Date: Mon, 18 Nov 1996 16:23:50 +0100 From: Emmanuel Engel X-Mailer: Mozilla 3.0 (X11; I; SunOS 5.4 sun4m) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Some cosmetics problems with ocaml Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis I have some cosmetics problems with ocaml. First it is not possible to simply create mli files with the command "ocamlc -c -i fool.ml > foo.mli". There is at least three reasons. First the compiler complain that we must compile interface file first. I need a compilation option to solve this problem. Something saying "generate .mli file forme infered type" will be OK. I can try "ocamlc -c -i foo.ml > a;mv a foo.mli". But again I have some problems. The first problem is that I have no solution to suppress warnings from the compiler output. So if i try to compile the following file with **** foo.ml ******* let f 1 = 1 ****************** the resulting a file will be ******** foo.mli ******** File "foo.ml", line 1, characters 6-10: Warning: this pattern-matching is not exhaustive val f : int -> int ************************* This file does not compile. The second problem is with mutualy recursives type definitions. **** foo.ml ****************** type foo = N | C of int * froz ref and froz = V of foo | T of (unit -> foo) ******************************* the resulting foo.mli will be : ********* foo.mli ************* type foo = N | C of int * froz ref type froz = V of foo | T of (unit -> foo) ******************************* This file does not compile. That's all for interfaces. Let's talk about modules. Sometimes I want to define sets or map or somethings else for a specifics data structure. I used to put the module set inside the module that define the data structure. I want to extend the function that I have defined for my data structure to sets. I find usefull to keep the same name for the function's extension but this is quite difficult: I can't refer to a function with is fully qualified name inside the module definition. Let's take an example. I'd like to write: ************* foo.ml ******************** type foo = N | C of int * froz ref and froz = V of foo | T of (unit -> foo) let rec eval_all = function C(_,{contents=V x}) -> eval_all x; | C(_,({contents=T f} as t)) -> let v= f () in t.contents <- (V v); v; | _ -> () module FooSet= struct type t = int list let rec eval_all = function | [] -> () | hd::tl -> (Foo.eval_all hd); (Foo.FooSet.eval_all tl) end ******************************************************* The problem is the last function eval_all. The values Foo.eval_all and Foo.FooSet.eval_all are undefined. I must write something like let eval_all = let rec f = function [] -> () |hd::tl -> (eval_all hd); (f tl) in f I find it less practical. -- - Emmanuel Engel