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 XAA07330; Thu, 30 May 2002 23:09:50 +0200 (MET DST) 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 XAA09954 for ; Thu, 30 May 2002 23:09:49 +0200 (MET DST) Received: from cs.bu.edu (cs.bu.edu [128.197.12.2]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g4UL9mT09596 for ; Thu, 30 May 2002 23:09:48 +0200 (MET DST) Received: from csa.bu.edu (zhudp@csa [128.197.12.3]) by cs.bu.edu (8.12.2/8.12.2) with ESMTP id g4UL9lF2023456 for ; Thu, 30 May 2002 17:09:47 -0400 (EDT) Received: from localhost (zhudp@localhost) by csa.bu.edu (8.10.1/8.10.1) with ESMTP id g4UL9hc01744 for ; Thu, 30 May 2002 17:09:43 -0400 (EDT) X-Authentication-Warning: csa.bu.edu: zhudp owned process doing -bs Date: Thu, 30 May 2002 17:09:43 -0400 (EDT) From: dengping zhu X-Sender: zhudp@csa.bu.edu To: Ocaml Subject: [Caml-list] about Obj.magic Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, all, When should I use 'Obj.magic'? It is really confusing. Now I am converting a bunch of code from sml to ocaml. During the process, I want to make sure that the type of every function keep consistent with the original one. But I still encountered a lot of problems about the types in ocaml. For examples, all my base functions are fine in ocaml. But, sometimes when I tried to combine a few base functions together in the same way as my original code, I got a type error. After endless trial, I have to use 'Obj.magic'. In some sense, it is good because I can compile my code now. On the other hand, things will be worse because it is very difficult to debug if I use a few 'Obj.magic' in my code. I couldn't find out the origins of all the runtime errors. So, we should be very careful to use 'Obj.magic'. Can somebody tell me the appropriate situation to use this function? Thanks a lot! Dengping ------------------- 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