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 CAA07678; Thu, 18 Apr 2002 02:06:56 +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 CAA07670 for ; Thu, 18 Apr 2002 02:06:55 +0200 (MET DST) Received: from favie.faith.gr.jp (favie.faith.gr.jp [61.127.175.250]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g3I06rb02274 for ; Thu, 18 Apr 2002 02:06:53 +0200 (MET DST) Received: from localhost (dhcp7.faith.gr.jp [192.168.1.17]) by favie.faith.gr.jp (8.9.3/8.9.3) with ESMTP id JAA10707; Thu, 18 Apr 2002 09:06:35 +0900 To: michael.marchegay@rd.francetelecom.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] type checking divergence for coercion In-Reply-To: <0489A7888F080B4BA73B53F7E145F29A1B0AAD@LANMHS20.rd.francetelecom.fr> References: <0489A7888F080B4BA73B53F7E145F29A1B0AAD@LANMHS20.rd.francetelecom.fr> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20020418090612M.garrigue@kurims.kyoto-u.ac.jp> Date: Thu, 18 Apr 2002 09:06:12 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: zze-MARCHEGAY Michael stagiaire FTRD/DTL/LAN > In the following exemple: > > class x = object > method bar (x0:a0) (x1:a1) (x2:a2) (x3:a3) (x4:a4) (x5:a5) (x6:a6) (x7:a7) > = > (x0, x1, x2, x3, x4, x5, x6, x7) > end > > and a0 = object inherit x end > and a1 = object inherit x end > and a2 = object inherit x end > and a3 = object inherit x end > and a4 = object inherit x end > and a5 = object inherit x end > and a6 = object inherit x end > and a7 = object inherit x end > > let _ = (new x :> x) > > the computation time required to evaluate the type of the expression > "let _ = (new x :> x)" diverges when paramters are added to the method bar. > > Do you have any idea on the origin of this divergence? I already answered to your (identical) bug report. This is related to the way the type checker computes the type of let f o = (o :> x) Here is the type if you stop at a1: val f : < bar : a0 -> a1 -> < bar : a0 -> a1 -> a0 * < bar : a0 -> a1 -> a0 * a1; .. >; .. > * < bar : a0 -> a1 -> < bar : a0 -> a1 -> a0 * a1; .. > * a1; .. >; .. > -> x = Clearly, the size is exponential in the number of a's. Try with a2 :-) This is not a bug, but the specification of simple coercions. The workaround is clear: use a double coercion. let f o = (o : a1 :> x);; val f : a1 -> x = Here computation time should be at most quadratic, I believe. Regards, Jacques Garrigue P.S. Could you deselect the "send also HTML" in your mailer. This makes your mails hard to read. ------------------- 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