From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 43251BBAF for ; Sun, 18 Jan 2009 07:24:43 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjQCAJNZcklDz4HegWdsb2JhbACUBAEBFiK7FoVz X-IronPort-AV: E=Sophos;i="4.37,283,1231110000"; d="scan'208";a="33893950" Received: from fettunta.fettunta.org ([67.207.129.222]) by mail4-smtp-sop.national.inria.fr with ESMTP; 18 Jan 2009 07:24:42 +0100 Received: from usha.takhisis.invalid (unknown [10.17.0.10]) by fettunta.fettunta.org (Postfix) with ESMTP id 42CDF1814E for ; Sun, 18 Jan 2009 06:24:41 +0000 (UTC) Received: by usha.takhisis.invalid (Postfix, from userid 1000) id 3FA56609E; Sun, 18 Jan 2009 07:24:28 +0100 (CET) Date: Sun, 18 Jan 2009 07:24:28 +0100 From: Stefano Zacchiroli To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] C++/C# inheritance is bad? Message-ID: <20090118062428.GB10304@usha.takhisis.invalid> References: <91a2ba3e0901161027x5432afcbh504b4ca3df501851@mail.gmail.com> <23738f080901161914tb290576yd2306babe68887ea@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam: no; 0.00; zacchiroli:01 zack:01 runtime:01 polymorphism:01 afaict:01 ad-hoc:01 polymorphism:01 functors:01 ocaml:01 functor:01 cheers:01 lri:01 signoles:01 zacchiroli:01 postdoc:01 On Sat, Jan 17, 2009 at 09:07:19AM -0500, Kuba Ober wrote: >> I thought he was talking about the effects of runtime polymorphism on >> static code analysis. You can't tell which method is invoked if the >> method is virtual. > That's fine, because if your code is written well it doesn't matter at > all which one it is. All you care about is the interface and not the > particular implementation -- assuming that all implementations adhere It seems to me that you are implicitly assuming that the interface is expressive enough to encode all the good properties you want your code to obey to, while it is not the case, especially for mainstream OO languages whose type systems are waaaaaaay too lightweight. Hence, the reference to static analysis above was, AFAICT, specifically meant to prove properties which are not encoded by the method interfaces, and hence depend on the method implementations. And precisely that you are screwed, because you need to know which method is actually called, which is harder with ad-hoc polymorphism. Somebody mentioned in this thread that the same problem has to be faced with functors. That is true for the casual look at the code, but at least in OCaml the functor language can be completely expanded at compile time (or at least it was at the time of ocamldefun [1], unless I'm mistaken). Cheers. [1] http://www.lri.fr/~signoles/ocamldefun/index.en.html -- Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7 zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/ Dietro un grande uomo c'è ..| . |. Et ne m'en veux pas si je te tutoie sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime