caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Michael Vanier <mvanier@cs.caltech.edu>
To: alex@baretta.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] a design problem requiring downcasting? (long)
Date: Mon, 30 Sep 2002 00:09:08 -0700	[thread overview]
Message-ID: <200209300709.g8U798C00735@orchestra.cs.caltech.edu> (raw)
In-Reply-To: <3D9785D1.8080608@baretta.com> (message from Alessandro Baretta on Mon, 30 Sep 2002 00:59:29 +0200)


> Date: Mon, 30 Sep 2002 00:59:29 +0200
> From: Alessandro Baretta <alex@baretta.com>
> 
> Michael Vanier wrote:
> 
>  > 1) multiple dispatch polymorphism (dispatching on the 
> types of both obj1
>  >    and obj2).  This is the most elegant approach, but 
> almost no languages
>  >    support this (I think because it's very hard to 
> implement efficiently).
> 
> Oh, so what you really need is RTTI, not downcasting, 
> really. I cannot help you here. I think you need method 
> overloading for this one, and I doubt you'll get it soon in 
> O'Caml.

I definitely need RTTI.  I'm not sure why you think I need method
overloading.

> 
> I'm curious about this, so I would be glad if you let me 
> know what you end up doing.
> 
> Alex
> 

I'm not sure.  All the approaches I've seen in ocaml seem incredibly heavy
compared with RTTI in java (and/or more brittle).  I'm not sure about your
approach, though (it looks pretty light).  Thanks for the suggestion!

Here is a question for the language designers: is there a technical reason
why RTTI can't be done easily in the ocaml object system?  Or is the lack
of RTTI more of a "moral" issue?  Or is it just due to not enough time to
put in all the features one would like?  I can imagine that the fact that
subtyping is implicit for any class that implements the methods of a
superclass might make RTTI very tricky to implement cleanly in a general
way.  

It's too bad we can't all roll our own object systems for ocaml ;-)

Mike
-------------------
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


  reply	other threads:[~2002-09-30 10:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-26  9:01 Michael Vanier
2002-09-26 14:32 ` Remi VANICAT
2002-09-26 15:19 ` nadji
2002-09-26 15:27   ` Remi VANICAT
2002-09-26 15:55     ` nadji
2002-09-26 15:53 ` Jeffrey Palmer
2002-09-26 16:35 ` Oleg
2002-09-26 17:47 ` brogoff
2002-09-26 19:14 ` Fred Smith
2002-09-27 17:01   ` Tim Freeman
2002-09-26 22:46 ` Alessandro Baretta
2002-09-27  7:20 ` Francois Pottier
2002-09-27 10:16   ` Michael Vanier
2002-09-29 22:59     ` Alessandro Baretta
2002-09-30  7:09       ` Michael Vanier [this message]
2002-09-30  9:54         ` Alessandro Baretta

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=200209300709.g8U798C00735@orchestra.cs.caltech.edu \
    --to=mvanier@cs.caltech.edu \
    --cc=alex@baretta.com \
    --cc=caml-list@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).