caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Stefano Zacchiroli <zack@upsilon.cc>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] C++/C# inheritance is bad?
Date: Sun, 18 Jan 2009 07:24:28 +0100	[thread overview]
Message-ID: <20090118062428.GB10304@usha.takhisis.invalid> (raw)
In-Reply-To: <A5F100AC-7E4E-4E3B-B414-470DC7566A98@osu.edu>

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


  reply	other threads:[~2009-01-18  6:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-16 15:18 Kuba Ober
2009-01-16 15:58 ` [Caml-list] " Richard Jones
2009-01-16 16:28   ` On the benefits of OO, Was: " Jan Kybic
2009-01-17 12:40     ` Oliver Bandel
2009-01-16 18:27 ` Raoul Duke
2009-01-16 21:42   ` Kuba Ober
2009-01-17  3:14     ` Sashan Govender
2009-01-17 14:07       ` Kuba Ober
2009-01-18  6:24         ` Stefano Zacchiroli [this message]
2009-01-17 13:27 ` Jon Harrop
2009-01-17 14:35   ` Kuba Ober
2009-01-17 16:59     ` Jon Harrop
2009-01-17 21:22       ` Kuba Ober
2009-01-17 22:17         ` Jon Harrop
2009-01-17 23:29           ` David Teller
2009-01-17 23:49             ` Jon Harrop
2009-01-19 16:22       ` Visitor in OCaml [was Re: [Caml-list] C++/C# inheritance is bad?] Yoann Padioleau
2009-01-19 16:41         ` blue storm
2009-01-19 17:49           ` Richard Jones
2009-01-19 17:52           ` Visitor in OCaml Christophe TROESTLER
2009-01-21 20:09           ` Yoann Padioleau
2009-01-22  4:03             ` [Caml-list] " Yaron Minsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090118062428.GB10304@usha.takhisis.invalid \
    --to=zack@upsilon.cc \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).