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 QAA12909; Mon, 21 Jun 2004 16:05:27 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 QAA12879 for ; Mon, 21 Jun 2004 16:05:24 +0200 (MET DST) Received: from mail3.epfl.ch (mail3.epfl.ch [128.178.50.19]) by concorde.inria.fr (8.12.10/8.12.10) with SMTP id i5LE5NSH018466 for ; Mon, 21 Jun 2004 16:05:23 +0200 Received: (qmail 17901 invoked by uid 107); 21 Jun 2004 14:05:23 -0000 Received: from mailav2.epfl.ch (HELO mailav2) (128.178.50.191) by mail3.epfl.ch with SMTP; 21 Jun 2004 14:05:23 -0000 Received: From mail0.epfl.ch ([128.178.50.57]) by mailav2 (WebShield SMTP v4.5 MR1a P0803.345); id 108782672520; Mon, 21 Jun 2004 16:05:25 +0200 Received: from lcmpc4.epfl.ch (128.178.8.59) by mail0.epfl.ch (AngelmatoPhylax SMTP proxy); Mon, 21 Jun 2004 16:05:22 +0200 Date: Mon, 21 Jun 2004 16:05:22 +0200 (CEST) From: Henri DF X-X-Sender: henridf@lcmpc4.epfl.ch To: caml-list@inria.fr Subject: [Caml-list] odd typing behavior Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 40D6EB23.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; proto:01 persist:01 hashtbl:01 persist:01 hashtbl:01 compiles:01 compiles:01 int:01 int:01 dump:01 dump:01 abbreviation:02 float:02 float:02 henri:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Here is a boiled-down example of a problem that i can't figure out. Can anyone explain this ? thanks henri version 1: --------- Compiling this fails with File "proto/str/test.ml", line 5, characters 5-109: The abbreviation c expands to type < dump_state : persist_t > but is used with type < .. > let h = Hashtbl.create 1 type persist_t = {rt : int} class c = object(s) initializer Hashtbl.replace h 1 (s :> c); method dump_state = {rt=1 } end version 2: --------- Same as version 1, except we use a float rather than a record for type persist_t. This one compiles fine. let h = Hashtbl.create 1 type persist_t = float class c = object(s) initializer Hashtbl.replace h 1 (s :> c); method dump_state = 1.0 end version 3: --------- Same as version 1, except the first 2 lines are interchanged. This one compiles fine. type persist_t = {rt : int} let h = Hashtbl.create 1 class c = object(s) initializer Hashtbl.replace h 1 (s :> c); method dump_state = {rt=1 } end ------------------- 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