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 QAA26147; Fri, 31 May 2002 16:07:43 +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 QAA26159 for ; Fri, 31 May 2002 16:07:42 +0200 (MET DST) Received: from relay-1m.club-internet.fr (relay-1m.club-internet.fr [194.158.104.40]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g4VE7f516445 for ; Fri, 31 May 2002 16:07:41 +0200 (MET DST) Received: from warp (lns11v-11-189.w.club-internet.fr [213.44.170.189]) by relay-1m.club-internet.fr (Postfix) with SMTP id 8440016E1; Fri, 31 May 2002 16:07:37 +0200 (CEST) Message-ID: <00b401c208ac$4d0eae00$7900a8c0@warp> From: "Warp" To: "Jacques Garrigue" , "OCaml" References: <003601c20884$0d78efd0$7900a8c0@warp> <20020531225840C.garrigue@kurims.kyoto-u.ac.jp> Subject: Re: [Caml-list] about Obj.magic Date: Fri, 31 May 2002 16:06:00 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > One case can be 'almost-legal' : downcasting an object to its implementation > > class if you're sure that it has been previously upcasted to the interface > > type class. > > > And here is how to break your code: > > class c = object method a : unit end > let i = new_intf (new c) > True. In fact that sample can't be used if the class also use shadow types which prevents the user from writing his own class and then making the program crash. Nicolas Cannasse ------------------- 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